feat(pluginhub): add driver remediation, failure diagnostics, and one-click CSAI Agent handoff
This commit is contained in:
parent
2c107dc80a
commit
5ae0d91ba8
|
|
@ -278,6 +278,7 @@ func (h *PluginHandler) createPlan(c *gin.Context) {
|
|||
response["artifact_digest"], response["host_approved"] = result.ArtifactDigest, result.HostApproved
|
||||
response["approval_policy"] = h.hub.ApprovalPolicy()
|
||||
response["can_confirm"] = h.hub.CanConfirm(record.ManifestDigest, result.ArtifactDigest)
|
||||
h.attachPlanDriverProbe(c.Request.Context(), record, response)
|
||||
c.JSON(http.StatusCreated, response)
|
||||
}
|
||||
|
||||
|
|
@ -298,9 +299,31 @@ func (h *PluginHandler) getPlan(c *gin.Context) {
|
|||
response["approved_at"] = record.ApprovedAt
|
||||
}
|
||||
}
|
||||
h.attachPlanDriverProbe(c.Request.Context(), record, response)
|
||||
c.JSON(http.StatusOK, response)
|
||||
}
|
||||
|
||||
func (h *PluginHandler) attachPlanDriverProbe(ctx context.Context, record database.PluginPlanRecord, response gin.H) {
|
||||
response["host_os"] = runtime.GOOS
|
||||
response["host_arch"] = runtime.GOARCH
|
||||
plan, err := manifest.DecodeInstallPlan([]byte(record.PlanJSON))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
compose := false
|
||||
if doc, err := manifest.DecodeDeclaration([]byte(record.ManifestJSON)); err == nil {
|
||||
for _, dist := range doc.Distribution {
|
||||
if dist.Type == plan.Artifact.Driver && dist.Mode == "compose" {
|
||||
compose = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
probeCtx, cancel := context.WithTimeout(ctx, 4*time.Second)
|
||||
defer cancel()
|
||||
response["driver_probe"] = h.hub.ProbePlanDriver(probeCtx, plan.Artifact.Driver, plan.Isolation, compose)
|
||||
}
|
||||
|
||||
func pluginPlanResponse(record database.PluginPlanRecord) gin.H {
|
||||
return gin.H{"plan": json.RawMessage(record.PlanJSON), "plan_digest": record.PlanDigest,
|
||||
"manifest": json.RawMessage(record.ManifestJSON), "policy": json.RawMessage(record.PolicyJSON)}
|
||||
|
|
|
|||
|
|
@ -161,12 +161,21 @@ func TestPluginManagementPreviewAndRBAC(t *testing.T) {
|
|||
planRequest := `{"inspection_id":"` + inspection.ID + `","isolation":"standard","driver":"git"}`
|
||||
request(http.MethodPost, "/install-plans", otherManager, planRequest, http.StatusNotFound)
|
||||
var response struct {
|
||||
Plan json.RawMessage `json:"plan"`
|
||||
Digest string `json:"plan_digest"`
|
||||
Plan json.RawMessage `json:"plan"`
|
||||
Digest string `json:"plan_digest"`
|
||||
HostOS string `json:"host_os"`
|
||||
HostArch string `json:"host_arch"`
|
||||
DriverProbe *struct {
|
||||
Available bool `json:"available"`
|
||||
Code string `json:"code"`
|
||||
} `json:"driver_probe"`
|
||||
}
|
||||
if err := json.Unmarshal(request(http.MethodPost, "/install-plans", admin, planRequest, http.StatusCreated), &response); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if response.HostOS == "" || response.HostArch == "" || response.DriverProbe == nil {
|
||||
t.Fatalf("expected driver_probe and host platform in plan response: %+v", response)
|
||||
}
|
||||
plan, err := manifest.DecodeInstallPlan(response.Plan)
|
||||
if err != nil || plan.Artifact.Commit != commit || plan.Isolation != "standard" || manifest.Digest(plan.Canonical) != response.Digest {
|
||||
t.Fatalf("plan %+v: %v; digest %s", plan, err, response.Digest)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import (
|
|||
"path/filepath"
|
||||
"regexp"
|
||||
"slices"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
|
@ -104,6 +105,21 @@ func (m *Manager) Probes(ctx context.Context, isolation string) map[string]runne
|
|||
return probes
|
||||
}
|
||||
|
||||
func (m *Manager) ProbePlanDriver(ctx context.Context, driverName, isolation string, compose bool) runner.Probe {
|
||||
if driverName == "container" && compose {
|
||||
if docker, ok := m.drivers["container"].(interface {
|
||||
ProbeCompose(context.Context, string) runner.Probe
|
||||
}); ok {
|
||||
return docker.ProbeCompose(ctx, isolation)
|
||||
}
|
||||
}
|
||||
driver := m.drivers[driverName]
|
||||
if driver == nil {
|
||||
return runner.Probe{Code: "driver_unavailable", Guidance: "Selected plugin driver is not registered on this host."}
|
||||
}
|
||||
return driver.Probe(ctx, isolation)
|
||||
}
|
||||
|
||||
func (m *Manager) Ready() bool { return m.ready.Load() }
|
||||
|
||||
func (m *Manager) Start(ctx context.Context) error {
|
||||
|
|
@ -451,11 +467,17 @@ func (m *Manager) runOperation(parent context.Context, op database.PluginOperati
|
|||
log("Operation started: " + op.Kind)
|
||||
result, err = m.execute(ctx, current, op)
|
||||
if err != nil {
|
||||
detail := runner.SanitizeLog(err.Error(), nil)
|
||||
if detail != "" {
|
||||
log("Error detail: " + detail)
|
||||
}
|
||||
switch {
|
||||
case errors.Is(err, ErrUnapprovedArtifact):
|
||||
result.ErrorCode = "plugin_artifact_not_approved"
|
||||
case result.Observed == "cleanup_pending":
|
||||
result.ErrorCode = "plugin_cleanup_pending"
|
||||
case hasKnownDriverErrorCode(detail) != "":
|
||||
result.ErrorCode = hasKnownDriverErrorCode(detail)
|
||||
default:
|
||||
result.ErrorCode = "plugin_" + op.Kind + "_failed"
|
||||
}
|
||||
|
|
@ -484,3 +506,19 @@ func (m *Manager) runOperation(parent context.Context, op database.PluginOperati
|
|||
_ = os.RemoveAll(snapshotPath(runner.Spec{Root: filepath.Join(m.root, op.InstallID), VersionID: op.VersionID}))
|
||||
}
|
||||
}
|
||||
|
||||
func hasKnownDriverErrorCode(detail string) string {
|
||||
for _, code := range []string{
|
||||
"docker_cli_missing",
|
||||
"docker_daemon_unavailable",
|
||||
"docker_compose_missing",
|
||||
"docker_engine_unsupported",
|
||||
"docker_socket_missing",
|
||||
"git_missing",
|
||||
} {
|
||||
if strings.HasPrefix(detail, code+":") || detail == code {
|
||||
return code
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,6 +107,34 @@ func (d *Docker) Probe(ctx context.Context, isolation string) Probe {
|
|||
return d.probe(ctx, isolation, false)
|
||||
}
|
||||
|
||||
func dockerRemediation(code string) (installCmd, downloadURL string) {
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
switch code {
|
||||
case "docker_compose_missing":
|
||||
return `sudo apt-get update && sudo apt-get install -y docker-compose-plugin`, "https://docs.docker.com/compose/install/linux/"
|
||||
case "docker_daemon_unavailable":
|
||||
return `sudo systemctl enable --now docker && sudo usermod -aG docker "$USER"`, "https://docs.docker.com/engine/install/linux-postinstall/"
|
||||
default:
|
||||
return `sudo apt-get update && sudo apt-get install -y docker.io docker-compose-plugin && sudo systemctl enable --now docker && sudo usermod -aG docker "$USER"`, "https://docs.docker.com/engine/install/"
|
||||
}
|
||||
case "darwin":
|
||||
if code == "docker_daemon_unavailable" {
|
||||
return "open -a Docker", "https://www.docker.com/products/docker-desktop/"
|
||||
}
|
||||
return "brew install --cask docker && open -a Docker", "https://www.docker.com/products/docker-desktop/"
|
||||
case "windows":
|
||||
return "winget install -e --id Docker.DockerDesktop", "https://www.docker.com/products/docker-desktop/"
|
||||
default:
|
||||
return "", "https://docs.docker.com/get-docker/"
|
||||
}
|
||||
}
|
||||
|
||||
func dockerUnavailableProbe(code, guidance string) Probe {
|
||||
cmd, url := dockerRemediation(code)
|
||||
return Probe{Code: code, Guidance: guidance, InstallCommand: cmd, DownloadURL: url}
|
||||
}
|
||||
|
||||
func (d *Docker) probe(ctx context.Context, isolation string, compose bool) Probe {
|
||||
guidance := "Install Docker Desktop and start its local engine."
|
||||
if runtime.GOOS == "linux" {
|
||||
|
|
@ -114,15 +142,15 @@ func (d *Docker) probe(ctx context.Context, isolation string, compose bool) Prob
|
|||
}
|
||||
if runningInContainer() {
|
||||
if _, err := os.Stat("/var/run/docker.sock"); err != nil && os.Getenv("DOCKER_HOST") == "" {
|
||||
return Probe{Code: "docker_socket_missing", Guidance: "Configure a local Docker socket for CSAI or select an approved native distribution."}
|
||||
return dockerUnavailableProbe("docker_socket_missing", "Configure a local Docker socket for CSAI or select an approved native distribution.")
|
||||
}
|
||||
}
|
||||
out, err := d.run(ctx, nil, "version", "--format", "{{.Server.Os}}/{{.Server.Version}}")
|
||||
if err != nil {
|
||||
if errors.Is(err, exec.ErrNotFound) {
|
||||
return Probe{Code: "docker_cli_missing", Guidance: guidance}
|
||||
return dockerUnavailableProbe("docker_cli_missing", guidance)
|
||||
}
|
||||
return Probe{Code: "docker_daemon_unavailable", Guidance: guidance + " Check your local context and socket permissions."}
|
||||
return dockerUnavailableProbe("docker_daemon_unavailable", guidance+" Check your local context and socket permissions.")
|
||||
}
|
||||
osName, version, _ := strings.Cut(strings.TrimSpace(string(out)), "/")
|
||||
major, _, _ := strings.Cut(version, ".")
|
||||
|
|
@ -132,12 +160,12 @@ func (d *Docker) probe(ctx context.Context, isolation string, compose bool) Prob
|
|||
minimum = 28
|
||||
}
|
||||
if osName != "linux" || majorNumber < minimum {
|
||||
return Probe{Code: "docker_engine_unsupported", Guidance: fmt.Sprintf(
|
||||
"Use a local Linux-container Docker Engine version %d or later for %s isolation.", minimum, isolation)}
|
||||
return dockerUnavailableProbe("docker_engine_unsupported", fmt.Sprintf(
|
||||
"Use a local Linux-container Docker Engine version %d or later for %s isolation.", minimum, isolation))
|
||||
}
|
||||
if compose {
|
||||
if _, err := d.run(ctx, nil, "compose", "version", "--short"); err != nil {
|
||||
return Probe{Code: "docker_compose_missing", Guidance: "Install the Docker Compose v2 CLI plugin."}
|
||||
return dockerUnavailableProbe("docker_compose_missing", "Install the Docker Compose v2 CLI plugin.")
|
||||
}
|
||||
}
|
||||
if majorNumber < 28 {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,19 @@ func (n *Native) Probe(_ context.Context, isolation string) Probe {
|
|||
}
|
||||
if n.driver == "git" {
|
||||
if _, err := exec.LookPath("git"); err != nil {
|
||||
return Probe{Code: "git_missing", Guidance: "Install Git with your platform package manager and retry."}
|
||||
cmd := "sudo apt-get update && sudo apt-get install -y git"
|
||||
switch runtime.GOOS {
|
||||
case "darwin":
|
||||
cmd = "xcode-select --install"
|
||||
case "windows":
|
||||
cmd = "winget install -e --id Git.Git"
|
||||
}
|
||||
return Probe{
|
||||
Code: "git_missing",
|
||||
Guidance: "Install Git with your platform package manager and retry.",
|
||||
InstallCommand: cmd,
|
||||
DownloadURL: "https://git-scm.com/downloads",
|
||||
}
|
||||
}
|
||||
}
|
||||
return Probe{Available: true}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,11 @@ type Driver interface {
|
|||
}
|
||||
|
||||
type Probe struct {
|
||||
Available bool `json:"available"`
|
||||
Code string `json:"code,omitempty"`
|
||||
Guidance string `json:"guidance,omitempty"`
|
||||
Available bool `json:"available"`
|
||||
Code string `json:"code,omitempty"`
|
||||
Guidance string `json:"guidance,omitempty"`
|
||||
InstallCommand string `json:"install_command,omitempty"`
|
||||
DownloadURL string `json:"download_url,omitempty"`
|
||||
}
|
||||
|
||||
type Spec struct {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
/**
|
||||
* 跨页面将任务一键交接给 CSAI 自身 Agent(对话工作台)。
|
||||
* 使用 sessionStorage 暂存待执行提示词,跳转至 /chat 新会话后自动触发或回填。
|
||||
*/
|
||||
export const AGENT_HANDOFF_KEY = 'csai-agent-handoff';
|
||||
const HANDOFF_TTL_MS = 5 * 60 * 1000;
|
||||
|
||||
function readHandoff() {
|
||||
try {
|
||||
const raw = sessionStorage.getItem(AGENT_HANDOFF_KEY);
|
||||
if (!raw) return null;
|
||||
const parsed = JSON.parse(raw);
|
||||
if (!parsed || typeof parsed.prompt !== 'string' || !parsed.prompt.trim()) {
|
||||
return null;
|
||||
}
|
||||
if (parsed.createdAt && Date.now() - Number(parsed.createdAt) > HANDOFF_TTL_MS) {
|
||||
sessionStorage.removeItem(AGENT_HANDOFF_KEY);
|
||||
return null;
|
||||
}
|
||||
return parsed;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function queueAgentHandoff({ prompt, autoSend = true }) {
|
||||
try {
|
||||
sessionStorage.setItem(AGENT_HANDOFF_KEY, JSON.stringify({
|
||||
prompt: String(prompt || '').trim(),
|
||||
autoSend: Boolean(autoSend),
|
||||
createdAt: Date.now()
|
||||
}));
|
||||
} catch {
|
||||
/* storage unavailable */
|
||||
}
|
||||
}
|
||||
|
||||
export function peekAgentHandoff() {
|
||||
return readHandoff();
|
||||
}
|
||||
|
||||
export function consumeAgentHandoff() {
|
||||
const entry = readHandoff();
|
||||
try {
|
||||
sessionStorage.removeItem(AGENT_HANDOFF_KEY);
|
||||
} catch {
|
||||
/* storage unavailable */
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ import { api } from '../../lib/http';
|
|||
import { useAuth } from '../../lib/auth';
|
||||
import { useT } from '../../lib/i18n';
|
||||
import { consumeRetestAutosend, peekRetestAutosend } from '../../lib/retest';
|
||||
import { consumeAgentHandoff, peekAgentHandoff } from '../../lib/agent-handoff';
|
||||
import { useDebounced, useInterval, useLocalStorage, useResource } from '../../components/hooks';
|
||||
import { toastError, toastSuccess, toastWarning } from '../../components/ui';
|
||||
import ProjectFormModal from '../projects/project-form';
|
||||
|
|
@ -587,6 +588,43 @@ export default function Page() {
|
|||
}, [conversationId, detail.conversation, detail.error, sending, backgroundRunning, checkingRun,
|
||||
roleResolved, canWrite, canExecute, mode, model, resetRun, role, run, t, updateComposer]);
|
||||
|
||||
// 插件平台等功能页一键交接给 CSAI Agent:打开新对话时自动发出或回填任务提示词。
|
||||
useEffect(() => {
|
||||
if (conversationId) return;
|
||||
const entry = peekAgentHandoff();
|
||||
if (!entry) return;
|
||||
const message = String(entry.prompt || '').trim();
|
||||
if (!message) {
|
||||
consumeAgentHandoff();
|
||||
return;
|
||||
}
|
||||
if (sending || backgroundRunning || checkingRun || model.waitingForChannel || !roleResolved) return;
|
||||
consumeAgentHandoff();
|
||||
if (canWrite && canExecute && entry.autoSend !== false) {
|
||||
setDetail(prev => ({
|
||||
...prev,
|
||||
messages: [
|
||||
...(prev.messages || []),
|
||||
{ id: `local-${Date.now()}`, role: 'user', content: message, createdAt: new Date().toISOString() }
|
||||
]
|
||||
}));
|
||||
resetRun();
|
||||
updateComposer('', () => ({ draft: '', attachments: [] }));
|
||||
pendingRoleRef.current = role;
|
||||
run.send({
|
||||
message,
|
||||
mode,
|
||||
projectId: newProjectId,
|
||||
role,
|
||||
...model.request,
|
||||
hitl: canDecideHitl ? draftHitl || undefined : undefined
|
||||
});
|
||||
return;
|
||||
}
|
||||
updateComposer('', current => ({ ...current, draft: message }));
|
||||
}, [conversationId, sending, backgroundRunning, checkingRun, model, roleResolved,
|
||||
canWrite, canExecute, canDecideHitl, draftHitl, mode, newProjectId, resetRun, role, run, updateComposer]);
|
||||
|
||||
// 手动打开复测分支或自动发送被中断时:把服务端保存的 pending_prompt 回填输入框。
|
||||
useEffect(() => {
|
||||
const conversation = detail.conversation;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { useEffect, useMemo, useRef, useState } from 'react';
|
|||
import {
|
||||
Banner, Button, Checkbox, Input, InputNumber, Radio, RadioGroup, Select, Space, Tabs, TabPane, Tag, TextArea, Typography
|
||||
} from '@douyinfe/semi-ui';
|
||||
import { IconCheckCircleStroked, IconPlay, IconRefresh, IconStop } from '@douyinfe/semi-icons';
|
||||
import { IconBolt, IconCheckCircleStroked, IconExternalOpen, IconPlay, IconRefresh, IconStop } from '@douyinfe/semi-icons';
|
||||
import { useT } from '../../lib/i18n';
|
||||
import { CopyButton, Drawer, JsonViewer, KeyValueList, toastError, toastSuccess } from '../../components/ui';
|
||||
import {
|
||||
|
|
@ -11,17 +11,27 @@ import {
|
|||
|
||||
const { Text, Paragraph } = Typography;
|
||||
|
||||
export function PlanApprovalDrawer({ planResponse, channels, visible, onCancel, onConfirmed }) {
|
||||
export function PlanApprovalDrawer({
|
||||
planResponse, channels, visible, canUseAgent, onCancel, onConfirmed, onAskAgentDriverFix
|
||||
}) {
|
||||
const t = useT();
|
||||
const [autoBindLLM, setAutoBindLLM] = useState(true);
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const [liveProbe, setLiveProbe] = useState(null);
|
||||
const [reprobing, setReprobing] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (visible) setAutoBindLLM(true);
|
||||
}, [visible, planResponse?.plan?.id]);
|
||||
if (visible) {
|
||||
setAutoBindLLM(true);
|
||||
setLiveProbe(planResponse?.driver_probe || null);
|
||||
}
|
||||
}, [visible, planResponse?.plan?.id, planResponse?.driver_probe]);
|
||||
|
||||
const plan = planResponse?.plan;
|
||||
const manifest = planResponse?.manifest;
|
||||
const artifact = plan?.artifact;
|
||||
const effectiveProbe = liveProbe || planResponse?.driver_probe || null;
|
||||
const driverUnavailable = Boolean(effectiveProbe && !effectiveProbe.available);
|
||||
const llmDeclared = Boolean(manifest?.llm?.bindings?.length);
|
||||
const defaultChannel = useMemo(
|
||||
() => (channels || []).find(ch => ch.is_default) || (channels || [])[0] || null,
|
||||
|
|
@ -32,6 +42,29 @@ export function PlanApprovalDrawer({ planResponse, channels, visible, onCancel,
|
|||
return manifest.llm.bindings.some(b => b.protocol === defaultChannel.protocol);
|
||||
}, [llmDeclared, defaultChannel, manifest]);
|
||||
|
||||
const handleReprobe = async () => {
|
||||
if (!plan || !artifact?.driver) return;
|
||||
setReprobing(true);
|
||||
try {
|
||||
const res = await pluginApi.probes(plan.isolation || 'standard');
|
||||
const isCompose = (manifest?.distribution || []).some(
|
||||
d => d.type === artifact.driver && d.mode === 'compose'
|
||||
);
|
||||
const key = artifact.driver === 'container' && isCompose ? 'compose' : artifact.driver;
|
||||
const nextProbe = res?.drivers?.[key] || res?.drivers?.[artifact.driver];
|
||||
if (nextProbe) {
|
||||
setLiveProbe(nextProbe);
|
||||
if (nextProbe.available) {
|
||||
toastSuccess(t('pluginHub.driverNowReady', null, '运行驱动已就绪,可以继续一键安装'));
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
toastError(pluginErrorText(t, err));
|
||||
} finally {
|
||||
setReprobing(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleConfirm = async () => {
|
||||
if (!plan || !planResponse?.plan_digest) return;
|
||||
setSubmitting(true);
|
||||
|
|
@ -50,8 +83,6 @@ export function PlanApprovalDrawer({ planResponse, channels, visible, onCancel,
|
|||
}
|
||||
};
|
||||
|
||||
const artifact = plan?.artifact;
|
||||
|
||||
return (
|
||||
<Drawer
|
||||
title={t('pluginHub.planApprovalTitle', null, '确认插件安装计划')}
|
||||
|
|
@ -65,16 +96,72 @@ export function PlanApprovalDrawer({ planResponse, channels, visible, onCancel,
|
|||
theme="solid"
|
||||
type="primary"
|
||||
loading={submitting}
|
||||
disabled={!planResponse?.can_confirm}
|
||||
disabled={!planResponse?.can_confirm || driverUnavailable}
|
||||
onClick={handleConfirm}
|
||||
>
|
||||
{t('pluginHub.confirmInstall', null, '确认并一键安装')}
|
||||
{driverUnavailable
|
||||
? t('pluginHub.driverMissingBtn', null, '缺少运行驱动,请先安装依赖')
|
||||
: t('pluginHub.confirmInstall', null, '确认并一键安装')}
|
||||
</Button>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
{plan && manifest && (
|
||||
<div className="cs-ph-drawer-stack">
|
||||
{driverUnavailable && (
|
||||
<Banner
|
||||
type="danger"
|
||||
bordered
|
||||
closeIcon={null}
|
||||
title={t('pluginHub.driverMissingTitle', { driver: driverLabel(t, artifact?.driver) }, `当前宿主机缺少所需驱动:${driverLabel(t, artifact?.driver)}`)}
|
||||
description={
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginTop: 4 }}>
|
||||
<Text size="small">
|
||||
{pluginErrorText(t, effectiveProbe.code, effectiveProbe.guidance)}
|
||||
</Text>
|
||||
{effectiveProbe.install_command && (
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6, flexWrap: 'wrap' }}>
|
||||
<code className="cs-ph-mono" style={{ fontSize: 12, padding: '4px 8px', borderRadius: 4, background: 'var(--semi-color-fill-1)', wordBreak: 'break-all' }}>
|
||||
{effectiveProbe.install_command}
|
||||
</code>
|
||||
<CopyButton text={effectiveProbe.install_command} label={t('common.copy', null, '复制')} />
|
||||
</div>
|
||||
)}
|
||||
<Space wrap>
|
||||
{canUseAgent && onAskAgentDriverFix && (
|
||||
<Button
|
||||
size="small"
|
||||
theme="solid"
|
||||
type="primary"
|
||||
icon={<IconBolt />}
|
||||
onClick={() => onAskAgentDriverFix({
|
||||
driver: artifact?.driver,
|
||||
probe: effectiveProbe,
|
||||
hostOS: planResponse.host_os,
|
||||
hostArch: planResponse.host_arch,
|
||||
pluginTitle: manifest.metadata?.title || manifest.metadata?.id
|
||||
})}
|
||||
>
|
||||
{t('pluginHub.askAgentInstallDriver', null, '交给 CSAI Agent 自动安装配置')}
|
||||
</Button>
|
||||
)}
|
||||
{effectiveProbe.download_url && (
|
||||
<Button
|
||||
size="small"
|
||||
icon={<IconExternalOpen />}
|
||||
onClick={() => window.open(effectiveProbe.download_url, '_blank', 'noopener,noreferrer')}
|
||||
>
|
||||
{t('pluginHub.officialDownload', null, '官方下载')}
|
||||
</Button>
|
||||
)}
|
||||
<Button size="small" icon={<IconRefresh />} loading={reprobing} onClick={handleReprobe}>
|
||||
{t('pluginHub.recheckDriver', null, '重新检测')}
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{!planResponse.can_confirm && (
|
||||
<Banner
|
||||
type="warning"
|
||||
|
|
@ -558,7 +645,8 @@ export function ImportGitDrawer({ visible, initialEntry, onCancel, onPlanReady,
|
|||
}
|
||||
|
||||
export function PluginDetailDrawer({
|
||||
installId, initialTab = 'overview', visible, canManage, channels, onCancel, onRestartRequested, onChanged
|
||||
installId, initialTab = 'overview', visible, canManage, canUseAgent, channels,
|
||||
onCancel, onRestartRequested, onChanged, onAskAgentTroubleshoot
|
||||
}) {
|
||||
const t = useT();
|
||||
const [activeTab, setActiveTab] = useState(initialTab);
|
||||
|
|
@ -705,6 +793,34 @@ export function PluginDetailDrawer({
|
|||
<TabPane tab={t('pluginHub.tabOverview', null, '概览与权限')} itemKey="overview">
|
||||
{detail && (
|
||||
<div className="cs-ph-drawer-stack" style={{ marginTop: 12 }}>
|
||||
{(detail.observed_state === 'failed' || detail.observed_state === 'degraded') && (
|
||||
<Banner
|
||||
type="danger"
|
||||
bordered
|
||||
closeIcon={null}
|
||||
title={pluginErrorText(t, detail.last_error_code, t('pluginHub.errorInstallFailed', null, '插件安装或运行异常'))}
|
||||
description={
|
||||
<Space wrap style={{ marginTop: 4 }}>
|
||||
{canUseAgent && onAskAgentTroubleshoot && (
|
||||
<Button
|
||||
size="small"
|
||||
theme="solid"
|
||||
type="primary"
|
||||
icon={<IconBolt />}
|
||||
onClick={() => onAskAgentTroubleshoot(detail)}
|
||||
>
|
||||
{t('pluginHub.askAgentTroubleshoot', null, '交给 CSAI Agent 排错并修复')}
|
||||
</Button>
|
||||
)}
|
||||
{canManage && (
|
||||
<Button size="small" onClick={() => setActiveTab('logs')}>
|
||||
{t('pluginHub.viewLogs', null, '查看运行日志')}
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<KeyValueList columns={2} items={[
|
||||
{ label: t('pluginHub.installId', null, '实例 ID'), value: <span className="cs-ph-mono">{detail.id}</span> },
|
||||
{ label: t('pluginHub.pluginId', null, '插件标识'), value: detail.plugin_id },
|
||||
|
|
@ -843,7 +959,7 @@ export function PluginDetailDrawer({
|
|||
);
|
||||
}
|
||||
|
||||
export function RuntimeProbesDrawer({ visible, onCancel }) {
|
||||
export function RuntimeProbesDrawer({ visible, canUseAgent, onCancel, onAskAgentDriverFix }) {
|
||||
const t = useT();
|
||||
const [isolation, setIsolation] = useState('standard');
|
||||
const [data, setData] = useState(null);
|
||||
|
|
@ -870,7 +986,7 @@ export function RuntimeProbesDrawer({ visible, onCancel }) {
|
|||
title={t('pluginHub.runtimeProbesTitle', null, '宿主运行环境与驱动预检')}
|
||||
visible={visible}
|
||||
onCancel={onCancel}
|
||||
width={620}
|
||||
width={660}
|
||||
>
|
||||
<div className="cs-ph-drawer-stack">
|
||||
<Space style={{ justifyContent: 'space-between', width: '100%' }} wrap>
|
||||
|
|
@ -903,7 +1019,47 @@ export function RuntimeProbesDrawer({ visible, onCancel }) {
|
|||
{probe.available ? t('pluginHub.available', null, '可用') : (probe.code || t('pluginHub.unavailable', null, '不可用'))}
|
||||
</Tag>
|
||||
</Space>
|
||||
{!probe.available && probe.code && (
|
||||
<Text type="danger" size="small">{pluginErrorText(t, probe.code, probe.guidance)}</Text>
|
||||
)}
|
||||
{probe.guidance && <Text type="tertiary" size="small">{probe.guidance}</Text>}
|
||||
{!probe.available && probe.install_command && (
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6, flexWrap: 'wrap', marginTop: 4 }}>
|
||||
<code className="cs-ph-mono" style={{ fontSize: 12, padding: '4px 8px', borderRadius: 4, background: 'var(--semi-color-fill-1)', wordBreak: 'break-all' }}>
|
||||
{probe.install_command}
|
||||
</code>
|
||||
<CopyButton text={probe.install_command} label={t('common.copy', null, '复制')} />
|
||||
</div>
|
||||
)}
|
||||
{!probe.available && (canUseAgent || probe.download_url) && (
|
||||
<Space wrap style={{ marginTop: 6 }}>
|
||||
{canUseAgent && onAskAgentDriverFix && (
|
||||
<Button
|
||||
size="small"
|
||||
theme="solid"
|
||||
type="primary"
|
||||
icon={<IconBolt />}
|
||||
onClick={() => onAskAgentDriverFix({
|
||||
driver: name,
|
||||
probe,
|
||||
hostOS: data.os,
|
||||
hostArch: data.arch
|
||||
})}
|
||||
>
|
||||
{t('pluginHub.askAgentInstallDriver', null, '交给 CSAI Agent 自动安装配置')}
|
||||
</Button>
|
||||
)}
|
||||
{probe.download_url && (
|
||||
<Button
|
||||
size="small"
|
||||
icon={<IconExternalOpen />}
|
||||
onClick={() => window.open(probe.download_url, '_blank', 'noopener,noreferrer')}
|
||||
>
|
||||
{t('pluginHub.officialDownload', null, '官方下载')}
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
{data.drivers?.container && !data.drivers.container.available && (
|
||||
|
|
@ -913,8 +1069,8 @@ export function RuntimeProbesDrawer({ visible, onCancel }) {
|
|||
closeIcon={null}
|
||||
description={
|
||||
data.os === 'linux'
|
||||
? t('pluginHub.dockerInstallLinuxHint', null, 'Linux / Kali 宿主可在确认提权后通过发行版官方源安装 docker.io / docker-ce 与 docker-compose-plugin 并启动 dockerd,完成后点击上方「重新检测」;或优先使用 Release / Git 原生驱动。')
|
||||
: t('pluginHub.dockerInstallDesktopHint', null, 'macOS / Windows 请先安装并启动 Docker Desktop(或 OrbStack / WSL2 Docker),或选择 Release / Git 原生驱动。')
|
||||
? t('pluginHub.dockerInstallLinuxHint', null, 'Linux / Kali 宿主可直接点击上方「交给 CSAI Agent 自动安装配置」,或手动安装 docker.io 与 docker-compose-plugin 并启动 dockerd,完成后点击「重新检测」。')
|
||||
: t('pluginHub.dockerInstallDesktopHint', null, 'macOS / Windows 可点击「官方下载」安装并启动 Docker Desktop(或交给 Agent 通过 Homebrew/winget 协助安装),也可优先选择 Release / Git 原生驱动。')
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -27,16 +27,77 @@ const ERROR_KEYS = {
|
|||
plugin_llm_gateway_unavailable: ['pluginHub.errorLLMGatewayUnavailable', 'CSAI 插件模型网关未就绪'],
|
||||
plugin_web_unavailable: ['pluginHub.errorWebUnavailable', '插件 WebUI 代理未就绪或应用尚未健康启动'],
|
||||
plugin_embed_origin_or_permission_rejected: ['pluginHub.errorEmbedRejected', '无权访问该插件工作区或请求来源校验未通过'],
|
||||
plugin_record_not_found: ['pluginHub.errorNotFound', '未找到对应的插件记录或计划已过期']
|
||||
plugin_record_not_found: ['pluginHub.errorNotFound', '未找到对应的插件记录或计划已过期'],
|
||||
docker_cli_missing: ['pluginHub.errorDockerCliMissing', '宿主未安装 Docker CLI / Engine,容器类插件无法启动'],
|
||||
docker_daemon_unavailable: ['pluginHub.errorDockerDaemonUnavailable', '宿主 Docker 服务未启动,或当前运行用户无权访问 docker.sock'],
|
||||
docker_compose_missing: ['pluginHub.errorDockerComposeMissing', '宿主缺少 Docker Compose v2 插件'],
|
||||
docker_engine_unsupported: ['pluginHub.errorDockerEngineUnsupported', '宿主 Docker Engine 版本过低或不满足隔离档位要求'],
|
||||
docker_socket_missing: ['pluginHub.errorDockerSocketMissing', '容器内未挂载 /var/run/docker.sock'],
|
||||
git_missing: ['pluginHub.errorGitMissing', '宿主未安装 Git 工具'],
|
||||
plugin_install_failed: ['pluginHub.errorInstallFailed', '插件安装失败,请查看运行日志或交给 Agent 排错修复']
|
||||
};
|
||||
|
||||
export function pluginErrorText(t, error, fallback) {
|
||||
const code = error?.payload?.error || (typeof error?.message === 'string' ? error.message : '');
|
||||
const code = typeof error === 'string'
|
||||
? error
|
||||
: (error?.payload?.error || (typeof error?.message === 'string' ? error.message : ''));
|
||||
const entry = ERROR_KEYS[code];
|
||||
if (entry) {
|
||||
return t(entry[0], null, entry[1]);
|
||||
}
|
||||
return error?.message || fallback || t('common.loadFailed', null, '操作失败');
|
||||
return (typeof error === 'string' ? error : error?.message) || fallback || t('common.loadFailed', null, '操作失败');
|
||||
}
|
||||
|
||||
export function buildDriverFixPrompt({ driver, probe, hostOS, hostArch, pluginTitle }) {
|
||||
const lines = [
|
||||
`请帮我在当前 CyberStrikeAI 宿主机上安装并配置插件平台缺少的运行驱动「${driver}」。`,
|
||||
'',
|
||||
'### 当前诊断信息',
|
||||
`- 宿主机平台:${hostOS || 'unknown'}/${hostArch || 'unknown'}`,
|
||||
`- 缺少驱动:${driver}`,
|
||||
`- 预检错误码:${probe?.code || 'unavailable'}`,
|
||||
probe?.guidance ? `- 官方提示:${probe.guidance}` : '',
|
||||
probe?.install_command ? `- 参考安装命令:\`${probe.install_command}\`` : '',
|
||||
pluginTitle ? `- 待安装插件:${pluginTitle}` : '',
|
||||
'',
|
||||
'### 请按以下步骤协助完成',
|
||||
'1. 先检查当前宿主机系统发行版、当前运行用户、包管理器以及目标依赖(如 Docker / Docker Compose / Git)与服务/权限状态;',
|
||||
'2. 使用官方软件源或受信任方式安装并启动缺少的依赖(涉及 sudo 或系统变更时请清晰说明并走审批确认);',
|
||||
'3. 如果安装了 Docker,请同时确认 `dockerd` 已开机自启、Compose v2 可用,并检查当前运行 CyberStrikeAI 的用户是否有权限访问 `/var/run/docker.sock`;',
|
||||
'4. 执行验证命令确认驱动已正常可用(例如 `docker version && docker compose version` 或 `git --version`);',
|
||||
'5. 完成后告诉我是否需要重启 CyberStrikeAI 服务(例如新增 `docker` 用户组后),以便我回到「能力平台」继续一键安装插件。'
|
||||
].filter(Boolean);
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
export function buildPluginTroubleshootPrompt({ install, logs, hostOS, hostArch }) {
|
||||
const tail = (Array.isArray(logs) ? logs : [])
|
||||
.slice(-40)
|
||||
.map(item => `[${item.created_at || ''}] ${item.line}`)
|
||||
.join('\n');
|
||||
const lines = [
|
||||
`我在 CyberStrikeAI 插件化能力平台中安装/运行插件「${install?.title || install?.plugin_id || '未知插件'}」失败,请帮我排查根因并直接在宿主机上修复缺少的运行环境或依赖。`,
|
||||
'',
|
||||
'### 插件状态与诊断信息',
|
||||
`- 插件名称:${install?.title || '—'} (${install?.plugin_id || '—'})`,
|
||||
`- 实例 ID:${install?.id || '—'}`,
|
||||
`- 运行驱动:${install?.driver || '—'}`,
|
||||
`- 当前状态:${install?.observed_state || 'failed'}`,
|
||||
`- 最近错误码:${install?.last_error_code || 'plugin_install_failed'}`,
|
||||
install?.repository ? `- 源码仓库:${install.repository}` : '',
|
||||
hostOS ? `- 宿主机平台:${hostOS}/${hostArch || ''}` : '',
|
||||
'',
|
||||
'### 最近插件脱敏日志',
|
||||
'```text',
|
||||
tail || '(暂无日志输出,请直接检查对应驱动的宿主机运行环境)',
|
||||
'```',
|
||||
'',
|
||||
'### 请协助完成',
|
||||
'1. 根据错误码和日志定位失败根因(例如缺少 Docker / Compose / Git / Go / Node.js、dockerd 未启动、docker.sock 权限不足、端口或网络问题等);',
|
||||
'2. 如果缺少运行环境或依赖,请直接帮我在宿主机上安装并配置就绪(涉及提权或系统改动时按审批确认);',
|
||||
'3. 验证宿主机依赖已恢复正常,并告诉我接下来回到「能力平台」直接点击重试/启动即可。'
|
||||
].filter(Boolean);
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
export function stateColor(state) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
import { useNavigate, useSearchParams } from 'react-router-dom';
|
||||
import {
|
||||
Banner, Button, Checkbox, Input, Space, Tabs, TabPane, Tag, Tooltip, Typography
|
||||
} from '@douyinfe/semi-ui';
|
||||
|
|
@ -9,12 +9,15 @@ import {
|
|||
} from '@douyinfe/semi-icons';
|
||||
import { useAuth } from '../../lib/auth';
|
||||
import { useT } from '../../lib/i18n';
|
||||
import { queueAgentHandoff } from '../../lib/agent-handoff';
|
||||
import { useInterval, useResource } from '../../components/hooks';
|
||||
import {
|
||||
DataTable, ErrorBanner, PageHeader, SectionCard, StatGrid, confirmAction, toastError, toastSuccess
|
||||
} from '../../components/ui';
|
||||
import { formatDateTime } from '../../lib/format';
|
||||
import { driverLabel, pluginApi, pluginErrorText, stateColor, stateLabel } from './api';
|
||||
import {
|
||||
buildDriverFixPrompt, buildPluginTroubleshootPrompt, driverLabel, pluginApi, pluginErrorText, stateColor, stateLabel
|
||||
} from './api';
|
||||
import WorkspaceView from './WorkspaceView';
|
||||
import { AddCatalogDrawer, ImportGitDrawer, PlanApprovalDrawer, PluginDetailDrawer, RuntimeProbesDrawer } from './Drawers';
|
||||
import './page.css';
|
||||
|
|
@ -23,9 +26,11 @@ const { Text, Paragraph } = Typography;
|
|||
|
||||
export default function PluginHubPage() {
|
||||
const t = useT();
|
||||
const navigate = useNavigate();
|
||||
const { hasPermission } = useAuth();
|
||||
const canManage = hasPermission('plugins:manage');
|
||||
const canUse = hasPermission('plugins:use');
|
||||
const canUseAgent = hasPermission('chat:write') && hasPermission('agent:execute');
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
|
||||
const activeAppId = searchParams.get('app') || '';
|
||||
|
|
@ -166,6 +171,41 @@ export default function PluginHubPage() {
|
|||
}
|
||||
};
|
||||
|
||||
const askAgentFixDriver = useCallback(({ driver, probe, hostOS, hostArch, pluginTitle }) => {
|
||||
const prompt = buildDriverFixPrompt({
|
||||
driver,
|
||||
probe,
|
||||
hostOS: hostOS || probesRes.data?.os,
|
||||
hostArch: hostArch || probesRes.data?.arch,
|
||||
pluginTitle
|
||||
});
|
||||
queueAgentHandoff({ prompt, autoSend: true });
|
||||
setProbesOpen(false);
|
||||
setPlanState(null);
|
||||
toastSuccess(t('pluginHub.handoffToAgent', null, '已将安装任务交给 CSAI Agent,正在跳转对话工作台…'));
|
||||
navigate('/chat');
|
||||
}, [navigate, probesRes.data?.arch, probesRes.data?.os, t]);
|
||||
|
||||
const askAgentTroubleshootPlugin = useCallback(async install => {
|
||||
let logs = [];
|
||||
try {
|
||||
const res = await pluginApi.readLogs(install.id, 0, 50);
|
||||
logs = Array.isArray(res?.items) ? res.items : [];
|
||||
} catch {
|
||||
// proceed with error code even if log read fails
|
||||
}
|
||||
const prompt = buildPluginTroubleshootPrompt({
|
||||
install,
|
||||
logs,
|
||||
hostOS: probesRes.data?.os,
|
||||
hostArch: probesRes.data?.arch
|
||||
});
|
||||
queueAgentHandoff({ prompt, autoSend: true });
|
||||
setDetailTarget(null);
|
||||
toastSuccess(t('pluginHub.handoffTroubleshoot', null, '已将排错与修复任务交给 CSAI Agent,正在跳转对话工作台…'));
|
||||
navigate('/chat');
|
||||
}, [navigate, probesRes.data?.arch, probesRes.data?.os, t]);
|
||||
|
||||
const runOperation = async (install, kind, extra = {}) => {
|
||||
setBusyInstallId(install.id);
|
||||
try {
|
||||
|
|
@ -239,9 +279,11 @@ export default function PluginHubPage() {
|
|||
initialTab={detailTarget?.tab}
|
||||
visible={Boolean(detailTarget)}
|
||||
canManage={canManage}
|
||||
canUseAgent={canUseAgent}
|
||||
channels={channels}
|
||||
onCancel={() => setDetailTarget(null)}
|
||||
onRestartRequested={item => runOperation(item, 'restart')}
|
||||
onAskAgentTroubleshoot={askAgentTroubleshootPlugin}
|
||||
onChanged={reloadAll}
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -259,7 +301,9 @@ export default function PluginHubPage() {
|
|||
<Tag size="small" color="grey">{record.plugin_id}</Tag>
|
||||
</Space>
|
||||
{record.last_error_code && (
|
||||
<Text type="danger" size="small">{record.last_error_code}</Text>
|
||||
<Text type="danger" size="small">
|
||||
{pluginErrorText(t, record.last_error_code, record.last_error_code)}
|
||||
</Text>
|
||||
)}
|
||||
</Space>
|
||||
)
|
||||
|
|
@ -303,10 +347,21 @@ export default function PluginHubPage() {
|
|||
</Button>
|
||||
)}
|
||||
{canManage && !isRunning && (
|
||||
<Tooltip content={t('pluginHub.start', null, '启动')}>
|
||||
<Tooltip content={record.observed_state === 'failed' ? t('pluginHub.retryInstallOrStart', null, '重试安装 / 启动') : t('pluginHub.start', null, '启动')}>
|
||||
<Button size="small" icon={<IconPlay />} loading={isBusy} onClick={() => runOperation(record, 'start')} />
|
||||
</Tooltip>
|
||||
)}
|
||||
{canUseAgent && (record.observed_state === 'failed' || record.observed_state === 'degraded') && (
|
||||
<Button
|
||||
size="small"
|
||||
theme="light"
|
||||
type="warning"
|
||||
icon={<IconBolt />}
|
||||
onClick={() => askAgentTroubleshootPlugin(record)}
|
||||
>
|
||||
{t('pluginHub.agentFixBtn', null, 'Agent 排错')}
|
||||
</Button>
|
||||
)}
|
||||
{canManage && isRunning && (
|
||||
<>
|
||||
<Tooltip content={t('pluginHub.restart', null, '重启')}>
|
||||
|
|
@ -577,7 +632,9 @@ export default function PluginHubPage() {
|
|||
planResponse={planState}
|
||||
channels={channels}
|
||||
visible={Boolean(planState)}
|
||||
canUseAgent={canUseAgent}
|
||||
onCancel={() => setPlanState(null)}
|
||||
onAskAgentDriverFix={askAgentFixDriver}
|
||||
onConfirmed={op => {
|
||||
setPlanState(null);
|
||||
setActiveOp(op);
|
||||
|
|
@ -591,15 +648,19 @@ export default function PluginHubPage() {
|
|||
initialTab={detailTarget?.tab}
|
||||
visible={Boolean(detailTarget)}
|
||||
canManage={canManage}
|
||||
canUseAgent={canUseAgent}
|
||||
channels={channels}
|
||||
onCancel={() => setDetailTarget(null)}
|
||||
onRestartRequested={item => runOperation(item, 'restart')}
|
||||
onAskAgentTroubleshoot={askAgentTroubleshootPlugin}
|
||||
onChanged={reloadAll}
|
||||
/>
|
||||
|
||||
<RuntimeProbesDrawer
|
||||
visible={probesOpen}
|
||||
canUseAgent={canUseAgent}
|
||||
onCancel={() => setProbesOpen(false)}
|
||||
onAskAgentDriverFix={askAgentFixDriver}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1 @@
|
|||
var e=`csai-agent-handoff`;function t(){try{let t=sessionStorage.getItem(e);if(!t)return null;let n=JSON.parse(t);return!n||typeof n.prompt!=`string`||!n.prompt.trim()?null:n.createdAt&&Date.now()-Number(n.createdAt)>3e5?(sessionStorage.removeItem(e),null):n}catch{return null}}function n({prompt:t,autoSend:n=!0}){try{sessionStorage.setItem(e,JSON.stringify({prompt:String(t||``).trim(),autoSend:!!n,createdAt:Date.now()}))}catch{}}function r(){return t()}function i(){let n=t();try{sessionStorage.removeItem(e)}catch{}return n}export{r as n,n as r,i as t};
|
||||
|
|
@ -1 +1 @@
|
|||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{G as r,I as i,Lt as a,N as o,Pt as s,R as c,U as l,ft as u,i as d,lt as f,ut as p}from"./semi-65W_4I1v.js";import{F as m,I as h,P as g,a as _,b as v,c as y,d as b,f as x,l as S,m as C,p as w,s as T,u as E,x as D,y as O}from"./index-B3TlLo8G.js";var k=e(t(),1),A=e(n(),1),{Text:j}=r;function M(){let e=g(),{hasPermission:t}=m(),n=t(`agents:write`),r=t(`agents:delete`),[M,N]=(0,k.useState)(``),[P,F]=(0,k.useState)(null),[I,L]=(0,k.useState)(null),[R,z]=(0,k.useState)(!1),B=_(()=>h.get(`/multi-agent/markdown-agents`),[]),V=(Array.isArray(B.data?.agents)?B.data.agents:[]).filter(e=>{if(!M)return!0;let t=M.toLowerCase();return[e.name,e.id,e.filename,e.description].some(e=>String(e||``).toLowerCase().includes(t))}),H=async e=>{try{F(await h.get(`/multi-agent/markdown-agents/${encodeURIComponent(e.filename)}`))}catch(e){v(e,`读取智能体失败`)}},U=async()=>{let e=await I.form.validate();z(!0);try{await h.post(`/multi-agent/markdown-agents`,{filename:e.filename?.trim()||``,name:e.name.trim(),description:e.description?.trim()||``,instruction:e.instruction,kind:e.kind||`sub`,tools:String(e.tools||``).split(`,`).map(e=>e.trim()).filter(Boolean)}),D(`智能体已保存`),L(null),B.reload()}catch(e){v(e,`保存智能体失败`)}finally{z(!1)}},W=e=>O({title:`删除智能体「${e.name||e.filename}」?`,onOk:async()=>{await h.del(`/multi-agent/markdown-agents/${encodeURIComponent(e.filename)}`),D(`已删除`),B.reload()}});return(0,A.jsxs)(`div`,{children:[(0,A.jsx)(w,{title:e(`agents.title`,null,`智能体管理`),description:B.data?.dir?`目录:${B.data.dir}`:`以 Markdown 文件定义的子智能体与编排器。`,extra:(0,A.jsxs)(i,{children:[(0,A.jsx)(c,{icon:(0,A.jsx)(p,{}),onClick:()=>B.reload(),loading:B.loading,children:`刷新`}),n&&(0,A.jsx)(c,{theme:`solid`,type:`primary`,icon:(0,A.jsx)(u,{}),onClick:()=>L({record:null,form:{}}),children:`新建智能体`})]})}),B.data?.error&&(0,A.jsx)(S,{error:B.data.error}),(0,A.jsxs)(C,{title:`智能体(${V.length})`,children:[(0,A.jsx)(S,{error:B.error,onRetry:()=>B.reload()}),(0,A.jsx)(T,{columns:[{title:`智能体`,dataIndex:`name`,render:(e,t)=>(0,A.jsxs)(i,{vertical:!0,spacing:0,align:`start`,children:[(0,A.jsxs)(i,{children:[(0,A.jsx)(j,{strong:!0,children:e||t.id}),t.is_orchestrator&&(0,A.jsx)(o,{size:`small`,color:`purple`,children:`编排器`})]}),(0,A.jsx)(j,{type:`tertiary`,children:t.filename})]})},{title:`类型`,dataIndex:`kind`,width:110,render:e=>(0,A.jsx)(o,{size:`small`,children:e||`sub`})},{title:`描述`,dataIndex:`description`,render:e=>(0,A.jsx)(j,{type:`tertiary`,ellipsis:{showTooltip:!0},style:{maxWidth:460},children:e||`—`})},{title:`操作`,width:180,render:(e,t)=>(0,A.jsxs)(i,{children:[(0,A.jsx)(c,{size:`small`,theme:`borderless`,onClick:()=>H(t),children:`详情`}),n&&(0,A.jsx)(c,{size:`small`,theme:`borderless`,icon:(0,A.jsx)(s,{}),onClick:()=>L({record:t,form:{}})}),r&&(0,A.jsx)(c,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,A.jsx)(a,{}),onClick:()=>W(t)})]})}],dataSource:V,rowKey:`filename`,loading:B.loading,pagination:{pageSize:20},toolbar:(0,A.jsx)(l,{prefix:(0,A.jsx)(f,{}),value:M,onChange:N,placeholder:`搜索名称或文件名`,style:{width:280}})})]}),(0,A.jsx)(y,{title:I?.record?`编辑智能体`:`新建智能体`,visible:!!I,onCancel:()=>L(null),onOk:U,confirmLoading:R,width:760,children:(0,A.jsxs)(d,{getFormApi:e=>L(t=>t&&{...t,form:e}),initValues:I?.record?{filename:I.record.filename,name:I.record.name,description:I.record.description,kind:I.record.kind||`sub`}:{kind:`sub`},children:[(0,A.jsx)(d.Input,{field:`filename`,label:`文件名(留空自动生成)`,placeholder:`例如 recon.md`}),(0,A.jsx)(d.Input,{field:`name`,label:`名称`,rules:[{required:!0,message:`请输入名称`}]}),(0,A.jsx)(d.Input,{field:`description`,label:`描述`}),(0,A.jsx)(d.Select,{field:`kind`,label:`类型`,optionList:[{value:`sub`,label:`子智能体`},{value:`orchestrator`,label:`编排器`},{value:`plan_execute`,label:`计划执行`}]}),(0,A.jsx)(d.Input,{field:`tools`,label:`工具(逗号分隔)`,placeholder:`toolName, mcp::tool`}),(0,A.jsx)(d.TextArea,{field:`instruction`,label:`指令(Markdown)`,autosize:{minRows:8,maxRows:20}})]})},I?.record?.filename||`new-agent`),(0,A.jsx)(y,{title:P?.name||`智能体详情`,visible:!!P,onCancel:()=>F(null),width:720,children:P&&(0,A.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,A.jsx)(b,{items:[{label:`文件名`,value:P.filename},{label:`ID`,value:P.id},{label:`类型`,value:P.kind},{label:`绑定角色`,value:P.bind_role||`—`},{label:`最大迭代`,value:P.max_iterations??`—`},{label:`工具`,value:Array.isArray(P.tools)&&P.tools.length?P.tools.join(`、`):`—`}]}),(0,A.jsx)(x,{content:P.instruction||P.raw||``}),(0,A.jsx)(E,{value:P.raw||P,title:`原始 Markdown`,collapsed:!0})]})})]})}export{M as default};
|
||||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{G as r,I as i,Lt as a,N as o,Pt as s,R as c,U as l,ft as u,i as d,lt as f,ut as p}from"./semi-65W_4I1v.js";import{F as m,I as h,P as g,a as _,b as v,c as y,d as b,f as x,l as S,m as C,p as w,s as T,u as E,x as D,y as O}from"./index-BdnarFZR.js";var k=e(t(),1),A=e(n(),1),{Text:j}=r;function M(){let e=g(),{hasPermission:t}=m(),n=t(`agents:write`),r=t(`agents:delete`),[M,N]=(0,k.useState)(``),[P,F]=(0,k.useState)(null),[I,L]=(0,k.useState)(null),[R,z]=(0,k.useState)(!1),B=_(()=>h.get(`/multi-agent/markdown-agents`),[]),V=(Array.isArray(B.data?.agents)?B.data.agents:[]).filter(e=>{if(!M)return!0;let t=M.toLowerCase();return[e.name,e.id,e.filename,e.description].some(e=>String(e||``).toLowerCase().includes(t))}),H=async e=>{try{F(await h.get(`/multi-agent/markdown-agents/${encodeURIComponent(e.filename)}`))}catch(e){v(e,`读取智能体失败`)}},U=async()=>{let e=await I.form.validate();z(!0);try{await h.post(`/multi-agent/markdown-agents`,{filename:e.filename?.trim()||``,name:e.name.trim(),description:e.description?.trim()||``,instruction:e.instruction,kind:e.kind||`sub`,tools:String(e.tools||``).split(`,`).map(e=>e.trim()).filter(Boolean)}),D(`智能体已保存`),L(null),B.reload()}catch(e){v(e,`保存智能体失败`)}finally{z(!1)}},W=e=>O({title:`删除智能体「${e.name||e.filename}」?`,onOk:async()=>{await h.del(`/multi-agent/markdown-agents/${encodeURIComponent(e.filename)}`),D(`已删除`),B.reload()}});return(0,A.jsxs)(`div`,{children:[(0,A.jsx)(w,{title:e(`agents.title`,null,`智能体管理`),description:B.data?.dir?`目录:${B.data.dir}`:`以 Markdown 文件定义的子智能体与编排器。`,extra:(0,A.jsxs)(i,{children:[(0,A.jsx)(c,{icon:(0,A.jsx)(p,{}),onClick:()=>B.reload(),loading:B.loading,children:`刷新`}),n&&(0,A.jsx)(c,{theme:`solid`,type:`primary`,icon:(0,A.jsx)(u,{}),onClick:()=>L({record:null,form:{}}),children:`新建智能体`})]})}),B.data?.error&&(0,A.jsx)(S,{error:B.data.error}),(0,A.jsxs)(C,{title:`智能体(${V.length})`,children:[(0,A.jsx)(S,{error:B.error,onRetry:()=>B.reload()}),(0,A.jsx)(T,{columns:[{title:`智能体`,dataIndex:`name`,render:(e,t)=>(0,A.jsxs)(i,{vertical:!0,spacing:0,align:`start`,children:[(0,A.jsxs)(i,{children:[(0,A.jsx)(j,{strong:!0,children:e||t.id}),t.is_orchestrator&&(0,A.jsx)(o,{size:`small`,color:`purple`,children:`编排器`})]}),(0,A.jsx)(j,{type:`tertiary`,children:t.filename})]})},{title:`类型`,dataIndex:`kind`,width:110,render:e=>(0,A.jsx)(o,{size:`small`,children:e||`sub`})},{title:`描述`,dataIndex:`description`,render:e=>(0,A.jsx)(j,{type:`tertiary`,ellipsis:{showTooltip:!0},style:{maxWidth:460},children:e||`—`})},{title:`操作`,width:180,render:(e,t)=>(0,A.jsxs)(i,{children:[(0,A.jsx)(c,{size:`small`,theme:`borderless`,onClick:()=>H(t),children:`详情`}),n&&(0,A.jsx)(c,{size:`small`,theme:`borderless`,icon:(0,A.jsx)(s,{}),onClick:()=>L({record:t,form:{}})}),r&&(0,A.jsx)(c,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,A.jsx)(a,{}),onClick:()=>W(t)})]})}],dataSource:V,rowKey:`filename`,loading:B.loading,pagination:{pageSize:20},toolbar:(0,A.jsx)(l,{prefix:(0,A.jsx)(f,{}),value:M,onChange:N,placeholder:`搜索名称或文件名`,style:{width:280}})})]}),(0,A.jsx)(y,{title:I?.record?`编辑智能体`:`新建智能体`,visible:!!I,onCancel:()=>L(null),onOk:U,confirmLoading:R,width:760,children:(0,A.jsxs)(d,{getFormApi:e=>L(t=>t&&{...t,form:e}),initValues:I?.record?{filename:I.record.filename,name:I.record.name,description:I.record.description,kind:I.record.kind||`sub`}:{kind:`sub`},children:[(0,A.jsx)(d.Input,{field:`filename`,label:`文件名(留空自动生成)`,placeholder:`例如 recon.md`}),(0,A.jsx)(d.Input,{field:`name`,label:`名称`,rules:[{required:!0,message:`请输入名称`}]}),(0,A.jsx)(d.Input,{field:`description`,label:`描述`}),(0,A.jsx)(d.Select,{field:`kind`,label:`类型`,optionList:[{value:`sub`,label:`子智能体`},{value:`orchestrator`,label:`编排器`},{value:`plan_execute`,label:`计划执行`}]}),(0,A.jsx)(d.Input,{field:`tools`,label:`工具(逗号分隔)`,placeholder:`toolName, mcp::tool`}),(0,A.jsx)(d.TextArea,{field:`instruction`,label:`指令(Markdown)`,autosize:{minRows:8,maxRows:20}})]})},I?.record?.filename||`new-agent`),(0,A.jsx)(y,{title:P?.name||`智能体详情`,visible:!!P,onCancel:()=>F(null),width:720,children:P&&(0,A.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,A.jsx)(b,{items:[{label:`文件名`,value:P.filename},{label:`ID`,value:P.id},{label:`类型`,value:P.kind},{label:`绑定角色`,value:P.bind_role||`—`},{label:`最大迭代`,value:P.max_iterations??`—`},{label:`工具`,value:Array.isArray(P.tools)&&P.tools.length?P.tools.join(`、`):`—`}]}),(0,A.jsx)(x,{content:P.instruction||P.raw||``}),(0,A.jsx)(E,{value:P.raw||P,title:`原始 Markdown`,collapsed:!0})]})})]})}export{M as default};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
import{I as e,L as t}from"./index-B3TlLo8G.js";var n=encodeURIComponent,r=t=>e.get(`/c2/listeners`,t),i=t=>e.post(`/c2/listeners`,t),a=(t,r)=>e.put(`/c2/listeners/${n(t)}`,r),o=t=>e.del(`/c2/listeners/${n(t)}`),s=t=>e.post(`/c2/listeners/${n(t)}/start`,{}),c=t=>e.post(`/c2/listeners/${n(t)}/stop`,{}),l=t=>e.get(`/c2/sessions`,t),u=t=>e.get(`/c2/sessions/${n(t)}`),d=t=>e.del(`/c2/sessions/${n(t)}`),f=t=>e.del(`/c2/sessions`,{body:{ids:t}}),p=(t,{sleepSeconds:r,jitterPercent:i})=>e.put(`/c2/sessions/${n(t)}/sleep`,{sleep_seconds:r,jitter_percent:i}),m=(t,r)=>e.put(`/c2/sessions/${n(t)}/note`,{note:r}),h=t=>e.get(`/c2/tasks`,t),g=t=>e.get(`/c2/tasks/${n(t)}`),_=t=>e.post(`/c2/tasks`,t),v=(t,r)=>e.post(`/c2/sessions/${n(t)}/tasks`,r),y=t=>e.post(`/c2/tasks/${n(t)}/cancel`,{}),b=(t,r=30)=>e.get(`/c2/tasks/${n(t)}/wait`,{timeout:r},{timeout:(r+10)*1e3}),x=t=>e.del(`/c2/tasks`,{body:{ids:t}}),S=(e,r)=>t(`/c2/tasks/${n(e)}/result-file`,{filename:r}),C=t=>e.post(`/c2/payloads/oneliner`,t),w=t=>e.post(`/c2/payloads/build`,t),T=(e,r)=>t(`/c2/payloads/${n(e)}/download`,{filename:r}),E=t=>e.get(`/c2/events`,t),D=t=>e.del(`/c2/events`,{body:{ids:t}}),O=()=>e.get(`/c2/profiles`),k=t=>e.post(`/c2/profiles`,t),A=(t,r)=>e.put(`/c2/profiles/${n(t)}`,r),j=t=>e.del(`/c2/profiles/${n(t)}`);async function M(){try{let t=await e.get(`/projects`,{limit:200});return Array.isArray(t?.projects)?t.projects:[]}catch{return[]}}export{b as A,h as C,c as D,s as E,a as O,l as S,p as T,g as _,k as a,O as b,D as c,d,f,u as g,S as h,i,A as k,o as l,T as m,w as n,v as o,x as p,y as r,_ as s,C as t,j as u,E as v,m as w,M as x,r as y};
|
||||
import{I as e,L as t}from"./index-BdnarFZR.js";var n=encodeURIComponent,r=t=>e.get(`/c2/listeners`,t),i=t=>e.post(`/c2/listeners`,t),a=(t,r)=>e.put(`/c2/listeners/${n(t)}`,r),o=t=>e.del(`/c2/listeners/${n(t)}`),s=t=>e.post(`/c2/listeners/${n(t)}/start`,{}),c=t=>e.post(`/c2/listeners/${n(t)}/stop`,{}),l=t=>e.get(`/c2/sessions`,t),u=t=>e.get(`/c2/sessions/${n(t)}`),d=t=>e.del(`/c2/sessions/${n(t)}`),f=t=>e.del(`/c2/sessions`,{body:{ids:t}}),p=(t,{sleepSeconds:r,jitterPercent:i})=>e.put(`/c2/sessions/${n(t)}/sleep`,{sleep_seconds:r,jitter_percent:i}),m=(t,r)=>e.put(`/c2/sessions/${n(t)}/note`,{note:r}),h=t=>e.get(`/c2/tasks`,t),g=t=>e.get(`/c2/tasks/${n(t)}`),_=t=>e.post(`/c2/tasks`,t),v=(t,r)=>e.post(`/c2/sessions/${n(t)}/tasks`,r),y=t=>e.post(`/c2/tasks/${n(t)}/cancel`,{}),b=(t,r=30)=>e.get(`/c2/tasks/${n(t)}/wait`,{timeout:r},{timeout:(r+10)*1e3}),x=t=>e.del(`/c2/tasks`,{body:{ids:t}}),S=(e,r)=>t(`/c2/tasks/${n(e)}/result-file`,{filename:r}),C=t=>e.post(`/c2/payloads/oneliner`,t),w=t=>e.post(`/c2/payloads/build`,t),T=(e,r)=>t(`/c2/payloads/${n(e)}/download`,{filename:r}),E=t=>e.get(`/c2/events`,t),D=t=>e.del(`/c2/events`,{body:{ids:t}}),O=()=>e.get(`/c2/profiles`),k=t=>e.post(`/c2/profiles`,t),A=(t,r)=>e.put(`/c2/profiles/${n(t)}`,r),j=t=>e.del(`/c2/profiles/${n(t)}`);async function M(){try{let t=await e.get(`/projects`,{limit:200});return Array.isArray(t?.projects)?t.projects:[]}catch{return[]}}export{b as A,h as C,c as D,s as E,a as O,l as S,p as T,g as _,k as a,O as b,D as c,d,f,u as g,S as h,i,A as k,o as l,T as m,w as n,v as o,x as p,y as r,_ as s,C as t,j as u,E as v,m as w,M as x,r as y};
|
||||
|
|
@ -1 +1 @@
|
|||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{G as t,I as n,R as r}from"./semi-65W_4I1v.js";import{E as i,P as a,k as o}from"./index-B3TlLo8G.js";import"./c2-shared-DNv0OQHb.js";import{t as s}from"./react-QV7DAAIx.js";var c=e(s(),1),{Text:l}=t,u=[{value:`http_beacon`,label:`HTTP Beacon`},{value:`https_beacon`,label:`HTTPS Beacon`},{value:`tcp_reverse`,label:`TCP 反向`},{value:`websocket`,label:`WebSocket`}],d={running:`运行中`,stopped:`已停止`,error:`异常`},f={tcp_reverse:[{value:`bash`,label:`Bash (/dev/tcp)`},{value:`nc`,label:`Netcat (-e)`},{value:`nc_mkfifo`,label:`Netcat (mkfifo)`},{value:`python`,label:`Python`},{value:`perl`,label:`Perl`},{value:`powershell`,label:`PowerShell`}],http_beacon:[{value:`curl_beacon`,label:`Curl Beacon (HTTP)`}],https_beacon:[{value:`curl_beacon`,label:`Curl Beacon (HTTP)`}],websocket:[{value:`curl_beacon`,label:`Curl Beacon (HTTP)`}]},p=[{value:`shell`,label:`shell`},{value:`exec`,label:`exec`},{value:`ls`,label:`ls`},{value:`pwd`,label:`pwd`},{value:`cd`,label:`cd`},{value:`ps`,label:`ps`},{value:`kill_proc`,label:`kill_proc`},{value:`download`,label:`download`},{value:`upload`,label:`upload`},{value:`screenshot`,label:`screenshot`},{value:`sleep`,label:`sleep`},{value:`exit`,label:`exit`},{value:`self_delete`,label:`self_delete`},{value:`port_fwd`,label:`port_fwd`},{value:`socks_start`,label:`socks_start`},{value:`socks_stop`,label:`socks_stop`},{value:`load_assembly`,label:`load_assembly`},{value:`persist`,label:`persist`}],m=[{value:`queued`,label:`队列中`},{value:`sent`,label:`已发送`},{value:`running`,label:`执行中`},{value:`success`,label:`成功`},{value:`failed`,label:`失败`},{value:`cancelled`,label:`已取消`}],h=[{value:`info`,label:`信息`},{value:`warn`,label:`警告`},{value:`critical`,label:`严重`}],g=[{value:`listener`,label:`监听器`},{value:`session`,label:`会话`},{value:`task`,label:`任务`},{value:`payload`,label:`Payload`},{value:`opsec`,label:`OPSEC`}],_=[{value:`active`,label:`活跃`},{value:`sleeping`,label:`休眠`},{value:`dead`,label:`离线`},{value:`killed`,label:`已终止`}],v=[{value:`15m`,label:`最近15分钟`,ms:9e5},{value:`1h`,label:`最近1小时`,ms:36e5},{value:`24h`,label:`最近24小时`,ms:864e5},{value:`7d`,label:`最近7天`,ms:6048e5},{value:`all`,label:`全部`,ms:0}];function y(e){let t=v.find(t=>t.value===e);return!t||!t.ms?``:new Date(Date.now()-t.ms).toISOString()}function b({value:e,onChange:t,ns:i=`tasks`}){let o=a();return(0,c.jsxs)(n,{spacing:6,wrap:!0,className:`c2-time-presets`,children:[(0,c.jsx)(l,{type:`tertiary`,size:`small`,children:o(`c2.tasks.timePresets`,null,`快捷`)}),v.map(n=>(0,c.jsx)(r,{size:`small`,theme:n.value===e?`solid`:`borderless`,type:n.value===e?`primary`:`tertiary`,onClick:()=>t(n.value),children:o(`c2.${i}.preset${n.value===`all`?`All`:n.value}`,null,n.label)},n.value))]})}function x(e){let t=Number(e);return!Number.isFinite(t)||t<=0?`—`:t<1e3?`${Math.round(t)}ms`:t<6e4?`${(t/1e3).toFixed(1)}秒`:`${Math.round(t/6e4)}分钟`}function S({value:e}){let t=a();return e?(0,c.jsx)(`span`,{className:`c2-time-text`,title:i(e),children:o(e,t)}):(0,c.jsx)(l,{type:`tertiary`,children:`—`})}var C={running:`green`,stopped:`grey`,error:`red`},w={queued:`amber`,sent:`blue`,running:`blue`,success:`green`,failed:`red`,cancelled:`grey`},T={active:`green`,sleeping:`amber`,dead:`grey`,killed:`red`},E={info:`blue`,warn:`amber`,critical:`red`};export{d as a,T as c,m as d,p as f,y as g,x as h,C as i,_ as l,S as m,E as n,u as o,b as p,h as r,f as s,g as t,w as u};
|
||||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{G as t,I as n,R as r}from"./semi-65W_4I1v.js";import{E as i,P as a,k as o}from"./index-BdnarFZR.js";import"./c2-shared-CdRIcwcz.js";import{t as s}from"./react-QV7DAAIx.js";var c=e(s(),1),{Text:l}=t,u=[{value:`http_beacon`,label:`HTTP Beacon`},{value:`https_beacon`,label:`HTTPS Beacon`},{value:`tcp_reverse`,label:`TCP 反向`},{value:`websocket`,label:`WebSocket`}],d={running:`运行中`,stopped:`已停止`,error:`异常`},f={tcp_reverse:[{value:`bash`,label:`Bash (/dev/tcp)`},{value:`nc`,label:`Netcat (-e)`},{value:`nc_mkfifo`,label:`Netcat (mkfifo)`},{value:`python`,label:`Python`},{value:`perl`,label:`Perl`},{value:`powershell`,label:`PowerShell`}],http_beacon:[{value:`curl_beacon`,label:`Curl Beacon (HTTP)`}],https_beacon:[{value:`curl_beacon`,label:`Curl Beacon (HTTP)`}],websocket:[{value:`curl_beacon`,label:`Curl Beacon (HTTP)`}]},p=[{value:`shell`,label:`shell`},{value:`exec`,label:`exec`},{value:`ls`,label:`ls`},{value:`pwd`,label:`pwd`},{value:`cd`,label:`cd`},{value:`ps`,label:`ps`},{value:`kill_proc`,label:`kill_proc`},{value:`download`,label:`download`},{value:`upload`,label:`upload`},{value:`screenshot`,label:`screenshot`},{value:`sleep`,label:`sleep`},{value:`exit`,label:`exit`},{value:`self_delete`,label:`self_delete`},{value:`port_fwd`,label:`port_fwd`},{value:`socks_start`,label:`socks_start`},{value:`socks_stop`,label:`socks_stop`},{value:`load_assembly`,label:`load_assembly`},{value:`persist`,label:`persist`}],m=[{value:`queued`,label:`队列中`},{value:`sent`,label:`已发送`},{value:`running`,label:`执行中`},{value:`success`,label:`成功`},{value:`failed`,label:`失败`},{value:`cancelled`,label:`已取消`}],h=[{value:`info`,label:`信息`},{value:`warn`,label:`警告`},{value:`critical`,label:`严重`}],g=[{value:`listener`,label:`监听器`},{value:`session`,label:`会话`},{value:`task`,label:`任务`},{value:`payload`,label:`Payload`},{value:`opsec`,label:`OPSEC`}],_=[{value:`active`,label:`活跃`},{value:`sleeping`,label:`休眠`},{value:`dead`,label:`离线`},{value:`killed`,label:`已终止`}],v=[{value:`15m`,label:`最近15分钟`,ms:9e5},{value:`1h`,label:`最近1小时`,ms:36e5},{value:`24h`,label:`最近24小时`,ms:864e5},{value:`7d`,label:`最近7天`,ms:6048e5},{value:`all`,label:`全部`,ms:0}];function y(e){let t=v.find(t=>t.value===e);return!t||!t.ms?``:new Date(Date.now()-t.ms).toISOString()}function b({value:e,onChange:t,ns:i=`tasks`}){let o=a();return(0,c.jsxs)(n,{spacing:6,wrap:!0,className:`c2-time-presets`,children:[(0,c.jsx)(l,{type:`tertiary`,size:`small`,children:o(`c2.tasks.timePresets`,null,`快捷`)}),v.map(n=>(0,c.jsx)(r,{size:`small`,theme:n.value===e?`solid`:`borderless`,type:n.value===e?`primary`:`tertiary`,onClick:()=>t(n.value),children:o(`c2.${i}.preset${n.value===`all`?`All`:n.value}`,null,n.label)},n.value))]})}function x(e){let t=Number(e);return!Number.isFinite(t)||t<=0?`—`:t<1e3?`${Math.round(t)}ms`:t<6e4?`${(t/1e3).toFixed(1)}秒`:`${Math.round(t/6e4)}分钟`}function S({value:e}){let t=a();return e?(0,c.jsx)(`span`,{className:`c2-time-text`,title:i(e),children:o(e,t)}):(0,c.jsx)(l,{type:`tertiary`,children:`—`})}var C={running:`green`,stopped:`grey`,error:`red`},w={queued:`amber`,sent:`blue`,running:`blue`,success:`green`,failed:`red`,cancelled:`grey`},T={active:`green`,sleeping:`amber`,dead:`grey`,killed:`red`},E={info:`blue`,warn:`amber`,critical:`red`};export{d as a,T as c,m as d,p as f,y as g,x as h,C as i,_ as l,S as m,E as n,u as o,b as p,h as r,f as s,g as t,w as u};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{G as r,I as i,Lt as a,N as o,R as s,U as c,lt as l,ut as u}from"./semi-65W_4I1v.js";import{E as d,F as f,I as p,P as m,a as h,c as g,d as _,l as v,m as y,p as b,s as x,u as S,x as C,y as w}from"./index-B3TlLo8G.js";var T=e(t(),1),E=e(n(),1),{Text:D}=r;function O(){let e=m(),{hasPermission:t}=f(),n=t(`knowledge:delete`),[r,O]=(0,T.useState)(``),[k,A]=(0,T.useState)(50),[j,M]=(0,T.useState)(null),N=h(()=>p.get(`/knowledge/retrieval-logs`,{conversationId:r||void 0,limit:k}),[r,k]),P=Array.isArray(N.data?.logs)?N.data.logs:[],F=e=>w({title:`删除该检索日志?`,content:e.query||e.id,onOk:async()=>{await p.del(`/knowledge/retrieval-logs/${encodeURIComponent(e.id)}`),C(`已删除`),N.reload()}});return(0,E.jsxs)(`div`,{children:[(0,E.jsx)(b,{title:e(`knowledge.retrievalLogsTitle`,null,`检索历史`),description:`记录智能体每次知识库检索的语句、命中项与会话,用于回溯回答依据。`,extra:(0,E.jsx)(s,{icon:(0,E.jsx)(u,{}),onClick:()=>N.reload(),loading:N.loading,children:`刷新`})}),(0,E.jsxs)(y,{title:`检索记录(${P.length})`,children:[(0,E.jsx)(v,{error:N.error,onRetry:()=>N.reload()}),(0,E.jsx)(x,{columns:[{title:`检索语句`,dataIndex:`query`,render:(e,t)=>(0,E.jsx)(`button`,{type:`button`,className:`link-button`,onClick:()=>M(t),style:{background:`none`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`,color:`var(--semi-color-primary)`},children:e||`—`})},{title:`风险类型`,dataIndex:`riskType`,width:140,render:e=>e?(0,E.jsx)(o,{size:`small`,children:e}):`—`},{title:`命中知识项`,dataIndex:`retrievedItems`,width:120,render:e=>(0,E.jsxs)(D,{type:`tertiary`,children:[Array.isArray(e)?e.length:0,` 条`]})},{title:`会话`,dataIndex:`conversationId`,width:200,render:e=>(0,E.jsx)(D,{type:`tertiary`,ellipsis:{showTooltip:!0},children:e||`—`})},{title:`时间`,dataIndex:`createdAt`,width:180,render:e=>d(e)},{title:`操作`,width:110,render:(e,t)=>(0,E.jsxs)(i,{children:[(0,E.jsx)(s,{size:`small`,theme:`borderless`,onClick:()=>M(t),children:`详情`}),n&&(0,E.jsx)(s,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,E.jsx)(a,{}),onClick:()=>F(t)})]})}],dataSource:P,rowKey:`id`,loading:N.loading,pagination:!1,toolbar:(0,E.jsxs)(i,{children:[(0,E.jsx)(c,{prefix:(0,E.jsx)(l,{}),placeholder:`按会话 ID 过滤`,value:r,onChange:O,style:{width:260}}),(0,E.jsx)(c,{placeholder:`条数`,value:String(k),onChange:e=>A(Math.min(Math.max(Number(e)||50,1),500)),style:{width:100},suffix:(0,E.jsx)(D,{type:`tertiary`,children:`条`})})]})})]}),(0,E.jsx)(g,{title:`检索日志详情`,visible:!!j,onCancel:()=>M(null),width:560,children:j&&(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,E.jsx)(_,{items:[{label:`日志 ID`,value:j.id},{label:`检索语句`,value:j.query},{label:`风险类型`,value:j.riskType||`—`},{label:`会话 ID`,value:j.conversationId||`—`},{label:`消息 ID`,value:j.messageId||`—`},{label:`时间`,value:d(j.createdAt)}]}),(0,E.jsx)(S,{value:j.retrievedItems||[],title:`命中知识项`})]})})]})}export{O as default};
|
||||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{G as r,I as i,Lt as a,N as o,R as s,U as c,lt as l,ut as u}from"./semi-65W_4I1v.js";import{E as d,F as f,I as p,P as m,a as h,c as g,d as _,l as v,m as y,p as b,s as x,u as S,x as C,y as w}from"./index-BdnarFZR.js";var T=e(t(),1),E=e(n(),1),{Text:D}=r;function O(){let e=m(),{hasPermission:t}=f(),n=t(`knowledge:delete`),[r,O]=(0,T.useState)(``),[k,A]=(0,T.useState)(50),[j,M]=(0,T.useState)(null),N=h(()=>p.get(`/knowledge/retrieval-logs`,{conversationId:r||void 0,limit:k}),[r,k]),P=Array.isArray(N.data?.logs)?N.data.logs:[],F=e=>w({title:`删除该检索日志?`,content:e.query||e.id,onOk:async()=>{await p.del(`/knowledge/retrieval-logs/${encodeURIComponent(e.id)}`),C(`已删除`),N.reload()}});return(0,E.jsxs)(`div`,{children:[(0,E.jsx)(b,{title:e(`knowledge.retrievalLogsTitle`,null,`检索历史`),description:`记录智能体每次知识库检索的语句、命中项与会话,用于回溯回答依据。`,extra:(0,E.jsx)(s,{icon:(0,E.jsx)(u,{}),onClick:()=>N.reload(),loading:N.loading,children:`刷新`})}),(0,E.jsxs)(y,{title:`检索记录(${P.length})`,children:[(0,E.jsx)(v,{error:N.error,onRetry:()=>N.reload()}),(0,E.jsx)(x,{columns:[{title:`检索语句`,dataIndex:`query`,render:(e,t)=>(0,E.jsx)(`button`,{type:`button`,className:`link-button`,onClick:()=>M(t),style:{background:`none`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`,color:`var(--semi-color-primary)`},children:e||`—`})},{title:`风险类型`,dataIndex:`riskType`,width:140,render:e=>e?(0,E.jsx)(o,{size:`small`,children:e}):`—`},{title:`命中知识项`,dataIndex:`retrievedItems`,width:120,render:e=>(0,E.jsxs)(D,{type:`tertiary`,children:[Array.isArray(e)?e.length:0,` 条`]})},{title:`会话`,dataIndex:`conversationId`,width:200,render:e=>(0,E.jsx)(D,{type:`tertiary`,ellipsis:{showTooltip:!0},children:e||`—`})},{title:`时间`,dataIndex:`createdAt`,width:180,render:e=>d(e)},{title:`操作`,width:110,render:(e,t)=>(0,E.jsxs)(i,{children:[(0,E.jsx)(s,{size:`small`,theme:`borderless`,onClick:()=>M(t),children:`详情`}),n&&(0,E.jsx)(s,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,E.jsx)(a,{}),onClick:()=>F(t)})]})}],dataSource:P,rowKey:`id`,loading:N.loading,pagination:!1,toolbar:(0,E.jsxs)(i,{children:[(0,E.jsx)(c,{prefix:(0,E.jsx)(l,{}),placeholder:`按会话 ID 过滤`,value:r,onChange:O,style:{width:260}}),(0,E.jsx)(c,{placeholder:`条数`,value:String(k),onChange:e=>A(Math.min(Math.max(Number(e)||50,1),500)),style:{width:100},suffix:(0,E.jsx)(D,{type:`tertiary`,children:`条`})})]})})]}),(0,E.jsx)(g,{title:`检索日志详情`,visible:!!j,onCancel:()=>M(null),width:560,children:j&&(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,E.jsx)(_,{items:[{label:`日志 ID`,value:j.id},{label:`检索语句`,value:j.query},{label:`风险类型`,value:j.riskType||`—`},{label:`会话 ID`,value:j.conversationId||`—`},{label:`消息 ID`,value:j.messageId||`—`},{label:`时间`,value:d(j.createdAt)}]}),(0,E.jsx)(S,{value:j.retrievedItems||[],title:`命中知识项`})]})})]})}export{O as default};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{G as r,i}from"./semi-65W_4I1v.js";import{I as a,P as o,c as s,l as c,x as l}from"./index-B3TlLo8G.js";var u=e(t(),1),d=e(n(),1),{Text:f}=r,p=120,m=4e3;function h({visible:e,project:t,onCancel:n,onSaved:r}){let h=o(),g=(0,u.useId)(),[_,v]=(0,u.useState)(!1),[y,b]=(0,u.useState)(null),x=!!t?.id;return(0,u.useEffect)(()=>{b(null)},[e,t?.id]),(0,d.jsxs)(s,{visible:e,width:560,closable:!_,closeOnEsc:!_,onCancel:n,cancelButtonProps:{disabled:_},title:x?h(`projects.modalEditTitle`,null,`编辑项目`):h(`projects.modalNewTitle`,null,`新建项目`),formId:g,okText:x?h(`projects.saveChanges`,null,`保存修改`):h(`projects.createProject`,null,`创建项目`),confirmLoading:_,children:[(0,d.jsx)(f,{type:`tertiary`,size:`small`,children:x?h(`projects.modalEditSubtitle`,null,`修改项目名称与描述`):h(`projects.modalNewSubtitle`,null,`创建后可绑定对话,跨会话共享事实黑板`)}),(0,d.jsxs)(i,{id:g,onSubmit:async e=>{if(!_){v(!0),b(null);try{let n={name:e.name.trim(),description:(e.description||``).slice(0,m)},i=x?await a.put(`/projects/${t.id}`,n):await a.post(`/projects`,n);l(x?h(`projects.saved`,null,`已保存`):h(`projects.createProject`,null,`创建项目`)),r?.(i)}catch(e){b(e)}finally{v(!1)}}},initValues:{name:t?.name||``,description:t?.description||``},children:[(0,d.jsx)(i.Input,{id:`${g}-name`,field:`name`,maxLength:p,label:h(`projects.projectName`,null,`项目名称`),placeholder:h(`projects.projectNamePlaceholder`,null,`例如:某客户 Web 渗透`),rules:[{required:!0,whitespace:!0,message:h(`projects.enterProjectName`,null,`请输入项目名称`)}]}),(0,d.jsx)(i.TextArea,{id:`${g}-description`,field:`description`,rows:4,maxCount:m,label:h(`projects.projectDescription`,null,`项目描述`),placeholder:h(`projects.projectDescriptionPlaceholder`,null,`客户/任务备注、协作说明…`),extraText:h(`projects.descriptionLengthHint`,null,`仅供团队成员查阅,Agent 不会读取;需让 Agent 知晓的内容请写入事实黑板`)}),(0,d.jsx)(c,{error:y})]},`${e}-${t?.id||`new`}`)]})}export{h as t};
|
||||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{G as r,i}from"./semi-65W_4I1v.js";import{I as a,P as o,c as s,l as c,x as l}from"./index-BdnarFZR.js";var u=e(t(),1),d=e(n(),1),{Text:f}=r,p=120,m=4e3;function h({visible:e,project:t,onCancel:n,onSaved:r}){let h=o(),g=(0,u.useId)(),[_,v]=(0,u.useState)(!1),[y,b]=(0,u.useState)(null),x=!!t?.id;return(0,u.useEffect)(()=>{b(null)},[e,t?.id]),(0,d.jsxs)(s,{visible:e,width:560,closable:!_,closeOnEsc:!_,onCancel:n,cancelButtonProps:{disabled:_},title:x?h(`projects.modalEditTitle`,null,`编辑项目`):h(`projects.modalNewTitle`,null,`新建项目`),formId:g,okText:x?h(`projects.saveChanges`,null,`保存修改`):h(`projects.createProject`,null,`创建项目`),confirmLoading:_,children:[(0,d.jsx)(f,{type:`tertiary`,size:`small`,children:x?h(`projects.modalEditSubtitle`,null,`修改项目名称与描述`):h(`projects.modalNewSubtitle`,null,`创建后可绑定对话,跨会话共享事实黑板`)}),(0,d.jsxs)(i,{id:g,onSubmit:async e=>{if(!_){v(!0),b(null);try{let n={name:e.name.trim(),description:(e.description||``).slice(0,m)},i=x?await a.put(`/projects/${t.id}`,n):await a.post(`/projects`,n);l(x?h(`projects.saved`,null,`已保存`):h(`projects.createProject`,null,`创建项目`)),r?.(i)}catch(e){b(e)}finally{v(!1)}}},initValues:{name:t?.name||``,description:t?.description||``},children:[(0,d.jsx)(i.Input,{id:`${g}-name`,field:`name`,maxLength:p,label:h(`projects.projectName`,null,`项目名称`),placeholder:h(`projects.projectNamePlaceholder`,null,`例如:某客户 Web 渗透`),rules:[{required:!0,whitespace:!0,message:h(`projects.enterProjectName`,null,`请输入项目名称`)}]}),(0,d.jsx)(i.TextArea,{id:`${g}-description`,field:`description`,rows:4,maxCount:m,label:h(`projects.projectDescription`,null,`项目描述`),placeholder:h(`projects.projectDescriptionPlaceholder`,null,`客户/任务备注、协作说明…`),extraText:h(`projects.descriptionLengthHint`,null,`仅供团队成员查阅,Agent 不会读取;需让 Agent 知晓的内容请写入事实黑板`)}),(0,d.jsx)(c,{error:y})]},`${e}-${t?.id||`new`}`)]})}export{h as t};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,_ as n,g as r,t as i,y as a}from"./react-QV7DAAIx.js";import{$ as o,B as s,Ft as c,G as l,I as u,L as d,N as f,R as p,S as m,U as h,c as g,d as _,g as v,h as y,j as b,k as ee,lt as x,m as S,on as C,p as w,s as T,ut as E,y as D}from"./semi-65W_4I1v.js";import{A as O,D as k,E as A,F as j,I as M,L as N,M as P,N as F,P as te,R as I,S as L,T as R,_ as ne,a as re,b as z,d as B,j as V,l as H,m as U,n as W,o as G,p as ie,s as ae,u as oe,x as se,y as K}from"./index-B3TlLo8G.js";import{n as ce,r as le,t as ue}from"./model-channel-mQ6lfvSO.js";var q=e(t(),1),J=class extends Error{constructor(e,t){super(t?`第 ${t} 行:${e}`:e),this.name=`YamlError`,this.line=t||0}},de=/^(?:[-?:,\[\]{}#&*!|>'"%@`]|.*[:\s]$|.*\s#|.*[\n\r\t])/,fe=/^(?:true|false|null|~|yes|no|on|off|[-+]?(?:\d+|\d*\.\d+)(?:[eE][-+]?\d+)?)$/i;function pe(e){let t=String(e);return!(t===``||fe.test(t)||/^[-+]?(?:\d+\.\d*|\.\d+|\d+)(?:[eE][-+]?\d+)?$/.test(t)||de.test(t)||/^(?:\s)|:(?:\s|$)|[\r\n\t]/.test(t)||/[,[\]{}]/.test(t)||/^[!&*|>@`]/.test(t))}function Y(e){return JSON.stringify(String(e))}function me(e){let t=String(e);return pe(t)?t:Y(t)}function he(e){if(e==null)return`null`;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return Number.isFinite(e)?String(e):Y(String(e));let t=String(e);return pe(t)?t:Y(t)}function ge(e){return e==null||[`string`,`number`,`boolean`].includes(typeof e)}function _e(e,t,n,r){let i=` `.repeat(n),a=me(e);if(ge(t))r.push(`${i}${a}: ${he(t)}`);else if(Array.isArray(t)){if(!t.length){r.push(`${i}${a}: []`);return}r.push(`${i}${a}:`),be(t,n+2,r)}else Object.entries(t).length?(r.push(`${i}${a}:`),ve(t,n+2,r)):r.push(`${i}${a}: {}`)}function ve(e,t,n){for(let[r,i]of Object.entries(e))_e(r,i,t,n)}function ye(e,t,n){let r=` `.repeat(t);if(ge(e)){n.push(`${r}- ${he(e)}`);return}if(Array.isArray(e)){if(!e.length){n.push(`${r}- []`);return}n.push(`${r}-`),be(e,t+2,n);return}let i=Object.entries(e);if(!i.length){n.push(`${r}- {}`);return}let[a,o]=i[0],s=i.slice(1);ge(o)?n.push(`${r}- ${me(a)}: ${he(o)}`):(n.push(`${r}-`),_e(a,o,t+2,n));for(let[e,r]of s)_e(e,r,t+2,n)}function be(e,t,n){for(let r of e)ye(r,t,n)}function xe(e,{header:t}={}){let n=[];if(t){for(let e of String(t).replace(/\r\n?/g,`
|
||||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,_ as n,g as r,t as i,y as a}from"./react-QV7DAAIx.js";import{$ as o,B as s,Ft as c,G as l,I as u,L as d,N as f,R as p,S as m,U as h,c as g,d as _,g as v,h as y,j as b,k as ee,lt as x,m as S,on as C,p as w,s as T,ut as E,y as D}from"./semi-65W_4I1v.js";import{A as O,D as k,E as A,F as j,I as M,L as N,M as P,N as F,P as te,R as I,S as L,T as R,_ as ne,a as re,b as z,d as B,j as V,l as H,m as U,n as W,o as G,p as ie,s as ae,u as oe,x as se,y as K}from"./index-BdnarFZR.js";import{n as ce,r as le,t as ue}from"./model-channel-mQ6lfvSO.js";var q=e(t(),1),J=class extends Error{constructor(e,t){super(t?`第 ${t} 行:${e}`:e),this.name=`YamlError`,this.line=t||0}},de=/^(?:[-?:,\[\]{}#&*!|>'"%@`]|.*[:\s]$|.*\s#|.*[\n\r\t])/,fe=/^(?:true|false|null|~|yes|no|on|off|[-+]?(?:\d+|\d*\.\d+)(?:[eE][-+]?\d+)?)$/i;function pe(e){let t=String(e);return!(t===``||fe.test(t)||/^[-+]?(?:\d+\.\d*|\.\d+|\d+)(?:[eE][-+]?\d+)?$/.test(t)||de.test(t)||/^(?:\s)|:(?:\s|$)|[\r\n\t]/.test(t)||/[,[\]{}]/.test(t)||/^[!&*|>@`]/.test(t))}function Y(e){return JSON.stringify(String(e))}function me(e){let t=String(e);return pe(t)?t:Y(t)}function he(e){if(e==null)return`null`;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return Number.isFinite(e)?String(e):Y(String(e));let t=String(e);return pe(t)?t:Y(t)}function ge(e){return e==null||[`string`,`number`,`boolean`].includes(typeof e)}function _e(e,t,n,r){let i=` `.repeat(n),a=me(e);if(ge(t))r.push(`${i}${a}: ${he(t)}`);else if(Array.isArray(t)){if(!t.length){r.push(`${i}${a}: []`);return}r.push(`${i}${a}:`),be(t,n+2,r)}else Object.entries(t).length?(r.push(`${i}${a}:`),ve(t,n+2,r)):r.push(`${i}${a}: {}`)}function ve(e,t,n){for(let[r,i]of Object.entries(e))_e(r,i,t,n)}function ye(e,t,n){let r=` `.repeat(t);if(ge(e)){n.push(`${r}- ${he(e)}`);return}if(Array.isArray(e)){if(!e.length){n.push(`${r}- []`);return}n.push(`${r}-`),be(e,t+2,n);return}let i=Object.entries(e);if(!i.length){n.push(`${r}- {}`);return}let[a,o]=i[0],s=i.slice(1);ge(o)?n.push(`${r}- ${me(a)}: ${he(o)}`):(n.push(`${r}-`),_e(a,o,t+2,n));for(let[e,r]of s)_e(e,r,t+2,n)}function be(e,t,n){for(let r of e)ye(r,t,n)}function xe(e,{header:t}={}){let n=[];if(t){for(let e of String(t).replace(/\r\n?/g,`
|
||||
`).split(`
|
||||
`))n.push(`# ${e}`.trimEnd());n.length&&n.push(``)}return ge(e)?(n.push(he(e)),`${n.join(`
|
||||
`)}\n`):Array.isArray(e)?(e.length?be(e,0,n):n.push(`[]`),`${n.join(`
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{G as t,I as n,Lt as r,R as i,ut as a}from"./semi-65W_4I1v.js";import{D as o,F as s,I as c,O as l,P as u,_ as d,a as f,l as p,m,p as h,s as g,x as _,y as v}from"./index-B3TlLo8G.js";import{t as y}from"./react-QV7DAAIx.js";var b=e(y(),1),{Text:x}=t;function S(){let e=u(),{hasPermission:t}=s(),y=t(`skills:delete`),S=f(()=>c.get(`/skills/stats`),[]),C=Array.isArray(S.data?.stats)?S.data.stats:[],w=Number(S.data?.total_calls||0),T=Number(S.data?.total_success||0),E=w>0?T/w:null,D=()=>v({title:`清空所有技能调用统计?`,content:`只影响统计计数,不删除技能文件。`,onOk:async()=>{await c.del(`/skills/stats`),_(`统计已清空`),S.reload()}}),O=e=>v({title:`清空「${e}」的统计?`,onOk:async()=>{await c.del(`/skills/${encodeURIComponent(e)}/stats`),_(`已清空`),S.reload()}});return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(h,{title:e(`skills.monitorTitle`,null,`技能状态`),description:S.data?.skills_dir?`技能目录:${S.data.skills_dir}`:`统计技能被调用的次数、成功率与最近使用时间。`,extra:(0,b.jsxs)(n,{children:[(0,b.jsx)(i,{icon:(0,b.jsx)(a,{}),onClick:()=>S.reload(),loading:S.loading,children:`刷新`}),y&&(0,b.jsx)(i,{type:`danger`,theme:`light`,onClick:D,children:`清空全部统计`})]})}),(0,b.jsx)(d,{columns:4,metrics:[{id:`skills`,label:`技能总数`,value:o(S.data?.total_skills||0),loading:S.loading},{id:`calls`,label:`调用总数`,value:o(w),loading:S.loading},{id:`success`,label:`成功次数`,value:o(T),loading:S.loading},{id:`rate`,label:`成功率`,value:E===null?`—`:l(E),tone:E!==null&&E<.8?`warning`:`success`,loading:S.loading}]}),(0,b.jsxs)(m,{title:`按技能统计`,children:[(0,b.jsx)(p,{error:S.error,onRetry:()=>S.reload()}),(0,b.jsx)(g,{columns:[{title:`技能`,dataIndex:`skill_name`,render:e=>(0,b.jsx)(x,{strong:!0,children:e})},{title:`调用次数`,dataIndex:`total_calls`,width:120,render:e=>o(e||0)},{title:`成功`,dataIndex:`success_calls`,width:100,render:e=>o(e||0)},{title:`失败`,dataIndex:`failed_calls`,width:100,render:e=>Number(e)>0?(0,b.jsx)(x,{type:`danger`,children:o(e)}):`0`},{title:`最后调用`,dataIndex:`last_call_time`,width:180,render:e=>e||`—`},{title:`操作`,width:110,render:(e,t)=>y&&Number(t.total_calls)>0?(0,b.jsx)(i,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,b.jsx)(r,{}),onClick:()=>O(t.skill_name),children:`清空`}):null}],dataSource:C,rowKey:`skill_name`,loading:S.loading,pagination:{pageSize:20}})]})]})}export{S as default};
|
||||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{G as t,I as n,Lt as r,R as i,ut as a}from"./semi-65W_4I1v.js";import{D as o,F as s,I as c,O as l,P as u,_ as d,a as f,l as p,m,p as h,s as g,x as _,y as v}from"./index-BdnarFZR.js";import{t as y}from"./react-QV7DAAIx.js";var b=e(y(),1),{Text:x}=t;function S(){let e=u(),{hasPermission:t}=s(),y=t(`skills:delete`),S=f(()=>c.get(`/skills/stats`),[]),C=Array.isArray(S.data?.stats)?S.data.stats:[],w=Number(S.data?.total_calls||0),T=Number(S.data?.total_success||0),E=w>0?T/w:null,D=()=>v({title:`清空所有技能调用统计?`,content:`只影响统计计数,不删除技能文件。`,onOk:async()=>{await c.del(`/skills/stats`),_(`统计已清空`),S.reload()}}),O=e=>v({title:`清空「${e}」的统计?`,onOk:async()=>{await c.del(`/skills/${encodeURIComponent(e)}/stats`),_(`已清空`),S.reload()}});return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(h,{title:e(`skills.monitorTitle`,null,`技能状态`),description:S.data?.skills_dir?`技能目录:${S.data.skills_dir}`:`统计技能被调用的次数、成功率与最近使用时间。`,extra:(0,b.jsxs)(n,{children:[(0,b.jsx)(i,{icon:(0,b.jsx)(a,{}),onClick:()=>S.reload(),loading:S.loading,children:`刷新`}),y&&(0,b.jsx)(i,{type:`danger`,theme:`light`,onClick:D,children:`清空全部统计`})]})}),(0,b.jsx)(d,{columns:4,metrics:[{id:`skills`,label:`技能总数`,value:o(S.data?.total_skills||0),loading:S.loading},{id:`calls`,label:`调用总数`,value:o(w),loading:S.loading},{id:`success`,label:`成功次数`,value:o(T),loading:S.loading},{id:`rate`,label:`成功率`,value:E===null?`—`:l(E),tone:E!==null&&E<.8?`warning`:`success`,loading:S.loading}]}),(0,b.jsxs)(m,{title:`按技能统计`,children:[(0,b.jsx)(p,{error:S.error,onRetry:()=>S.reload()}),(0,b.jsx)(g,{columns:[{title:`技能`,dataIndex:`skill_name`,render:e=>(0,b.jsx)(x,{strong:!0,children:e})},{title:`调用次数`,dataIndex:`total_calls`,width:120,render:e=>o(e||0)},{title:`成功`,dataIndex:`success_calls`,width:100,render:e=>o(e||0)},{title:`失败`,dataIndex:`failed_calls`,width:100,render:e=>Number(e)>0?(0,b.jsx)(x,{type:`danger`,children:o(e)}):`0`},{title:`最后调用`,dataIndex:`last_call_time`,width:180,render:e=>e||`—`},{title:`操作`,width:110,render:(e,t)=>y&&Number(t.total_calls)>0?(0,b.jsx)(i,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,b.jsx)(r,{}),onClick:()=>O(t.skill_name),children:`清空`}):null}],dataSource:C,rowKey:`skill_name`,loading:S.loading,pagination:{pageSize:20}})]})]})}export{S as default};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -18,7 +18,7 @@
|
|||
} catch (error) { /* first paint fallback */ }
|
||||
})();
|
||||
</script>
|
||||
<script type="module" crossorigin src="/static/app/assets/index-B3TlLo8G.js"></script>
|
||||
<script type="module" crossorigin src="/static/app/assets/index-BdnarFZR.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/static/app/assets/rolldown-runtime-WkwZ5CU-.js">
|
||||
<link rel="modulepreload" crossorigin href="/static/app/assets/react-QV7DAAIx.js">
|
||||
<link rel="modulepreload" crossorigin href="/static/app/assets/semi-65W_4I1v.js">
|
||||
|
|
|
|||
|
|
@ -4965,8 +4965,8 @@
|
|||
"notReady": "غير جاهز",
|
||||
"available": "متاح",
|
||||
"unavailable": "غير متاح",
|
||||
"dockerInstallLinuxHint": "على Linux/Kali ثبّت docker.io أو docker-ce مع docker-compose-plugin بعد تأكيد الصلاحيات ثم اضغط تحديث.",
|
||||
"dockerInstallDesktopHint": "على macOS/Windows ثبّت وشغّل Docker Desktop أو اختر مشغلات Release/Git.",
|
||||
"dockerInstallLinuxHint": "على Linux / Kali اضغط «دع CSAI Agent يثبّت ويعدّ البيئة» أعلاه أو ثبّت docker.io وdocker-compose-plugin وشغّل dockerd ثم أعد الفحص.",
|
||||
"dockerInstallDesktopHint": "على macOS / Windows اضغط «تنزيل رسمي» لتثبيت Docker Desktop أو دع الوكيل يساعدك عبر Homebrew/winget، أو اختر مشغّل Release / Git الأصلي.",
|
||||
"confirmUninstallTitle": "إلغاء تثبيت الإضافة \"{{name}}\"؟",
|
||||
"confirmUninstallDesc": "سيتم إيقاف العمليات والحاويات وإلغاء جلسات الوكيل ورموز بوابة النماذج.",
|
||||
"purgeDataOption": "حذف مجلدات البيانات الدائمة أيضاً (تُحفظ افتراضياً)",
|
||||
|
|
@ -5033,6 +5033,24 @@
|
|||
"catalogDeleted": "تمت الإزالة من سوق القدرات",
|
||||
"catalogDeleteFailed": "فشل حذف عنصر السوق",
|
||||
"catalogRestored": "تمت استعادة جميع العناصر الافتراضية",
|
||||
"catalogRestoreFailed": "فشلت استعادة العناصر الافتراضية"
|
||||
"catalogRestoreFailed": "فشلت استعادة العناصر الافتراضية",
|
||||
"errorDockerCliMissing": "لم يتم تثبيت Docker CLI / Engine على هذا المضيف؛ لا يمكن تشغيل إضافات الحاويات",
|
||||
"errorDockerDaemonUnavailable": "خدمة Docker غير قيد التشغيل أو لا يملك المستخدم الحالي صلاحية الوصول إلى docker.sock",
|
||||
"errorDockerComposeMissing": "إضافة Docker Compose v2 مفقودة على هذا المضيف",
|
||||
"errorDockerEngineUnsupported": "إصدار Docker Engine على المضيف لا يفي بمتطلبات العزل",
|
||||
"errorDockerSocketMissing": "لم يتم ربط /var/run/docker.sock داخل الحاوية",
|
||||
"errorGitMissing": "أداة Git غير مثبتة على هذا المضيف",
|
||||
"errorInstallFailed": "فشل تثبيت الإضافة؛ راجع السجلات أو سلّم التشخيص إلى CSAI Agent",
|
||||
"driverNowReady": "المشغّل جاهز الآن؛ يمكنك متابعة التثبيت بنقرة واحدة",
|
||||
"driverMissingBtn": "المشغّل المطلوب مفقود — ثبّت المتطلبات أولًا",
|
||||
"driverMissingTitle": "المضيف يفتقد المشغّل المطلوب: {driver}",
|
||||
"askAgentInstallDriver": "دع CSAI Agent يثبّت ويعدّ البيئة",
|
||||
"askAgentTroubleshoot": "دع CSAI Agent يشخّص ويصلح",
|
||||
"agentFixBtn": "إصلاح عبر Agent",
|
||||
"officialDownload": "تنزيل رسمي",
|
||||
"recheckDriver": "إعادة الفحص",
|
||||
"retryInstallOrStart": "إعادة محاولة التثبيت / التشغيل",
|
||||
"handoffToAgent": "تم تسليم مهمة التثبيت إلى CSAI Agent — جارٍ فتح مساحة الدردشة…",
|
||||
"handoffTroubleshoot": "تم تسليم مهمة التشخيص والإصلاح إلى CSAI Agent — جارٍ فتح مساحة الدردشة…"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6100,8 +6100,8 @@
|
|||
"notReady": "Not Ready",
|
||||
"available": "Available",
|
||||
"unavailable": "Unavailable",
|
||||
"dockerInstallLinuxHint": "On Linux/Kali, install docker.io or docker-ce with docker-compose-plugin via your package manager after confirming privileges, then click Refresh; or use Release/Git drivers.",
|
||||
"dockerInstallDesktopHint": "On macOS/Windows, install and start Docker Desktop (or OrbStack / WSL2 Docker), or choose Release/Git drivers.",
|
||||
"dockerInstallLinuxHint": "On Linux / Kali, click \"Let CSAI Agent Install & Configure\" above or install docker.io + docker-compose-plugin and start dockerd, then click Re-check.",
|
||||
"dockerInstallDesktopHint": "On macOS / Windows, click Official Download to install Docker Desktop (or let CSAI Agent assist via Homebrew/winget), or choose a Release / Git native driver.",
|
||||
"confirmUninstallTitle": "Uninstall plugin \"{{name}}\"?",
|
||||
"confirmUninstallDesc": "Stops processes/containers, revokes proxy sessions & LLM gateway tokens, and retires the isolated origin.",
|
||||
"purgeDataOption": "Also delete persistent data volumes (preserved by default)",
|
||||
|
|
@ -6168,6 +6168,24 @@
|
|||
"catalogDeleted": "Removed from Capability Market",
|
||||
"catalogDeleteFailed": "Failed to remove market entry",
|
||||
"catalogRestored": "Restored all default curated entries",
|
||||
"catalogRestoreFailed": "Failed to restore default entries"
|
||||
"catalogRestoreFailed": "Failed to restore default entries",
|
||||
"errorDockerCliMissing": "Docker CLI / Engine is not installed on this host; container plugins cannot start",
|
||||
"errorDockerDaemonUnavailable": "Docker daemon is not running or the current user lacks permission to access docker.sock",
|
||||
"errorDockerComposeMissing": "Docker Compose v2 CLI plugin is missing on this host",
|
||||
"errorDockerEngineUnsupported": "Host Docker Engine version does not meet the isolation requirement",
|
||||
"errorDockerSocketMissing": "/var/run/docker.sock is not mounted inside the container",
|
||||
"errorGitMissing": "Git is not installed on this host",
|
||||
"errorInstallFailed": "Plugin installation failed; inspect logs or hand off to CSAI Agent to diagnose",
|
||||
"driverNowReady": "Driver is now ready; you can proceed with one-click install",
|
||||
"driverMissingBtn": "Required driver missing — install dependency first",
|
||||
"driverMissingTitle": "Host is missing required driver: {driver}",
|
||||
"askAgentInstallDriver": "Let CSAI Agent Install & Configure",
|
||||
"askAgentTroubleshoot": "Let CSAI Agent Diagnose & Fix",
|
||||
"agentFixBtn": "Agent Fix",
|
||||
"officialDownload": "Official Download",
|
||||
"recheckDriver": "Re-check",
|
||||
"retryInstallOrStart": "Retry Install / Start",
|
||||
"handoffToAgent": "Handed off setup task to CSAI Agent — opening Chat workspace…",
|
||||
"handoffTroubleshoot": "Handed off troubleshooting task to CSAI Agent — opening Chat workspace…"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6000,8 +6000,8 @@
|
|||
"notReady": "Не готов",
|
||||
"available": "Доступен",
|
||||
"unavailable": "Недоступен",
|
||||
"dockerInstallLinuxHint": "В Linux/Kali установите docker.io/docker-ce и docker-compose-plugin после подтверждения прав и нажмите Обновить.",
|
||||
"dockerInstallDesktopHint": "В macOS/Windows установите и запустите Docker Desktop или выберите нативный драйвер Release/Git.",
|
||||
"dockerInstallLinuxHint": "На Linux / Kali нажмите «Установить через CSAI Agent» выше или установите docker.io и docker-compose-plugin, запустите dockerd и нажмите «Проверить снова».",
|
||||
"dockerInstallDesktopHint": "На macOS / Windows нажмите «Официальная загрузка» для Docker Desktop (или поручите установку Agent через Homebrew/winget), либо выберите нативный драйвер Release / Git.",
|
||||
"confirmUninstallTitle": "Удалить плагин «{{name}}»?",
|
||||
"confirmUninstallDesc": "Остановит процессы/контейнеры, отзовет сессии и токены шлюза.",
|
||||
"purgeDataOption": "Удалить постоянные данные и тома (по умолчанию сохраняются)",
|
||||
|
|
@ -6068,6 +6068,24 @@
|
|||
"catalogDeleted": "Удалено из маркета",
|
||||
"catalogDeleteFailed": "Не удалось удалить запись маркета",
|
||||
"catalogRestored": "Все встроенные записи восстановлены",
|
||||
"catalogRestoreFailed": "Не удалось восстановить встроенные записи"
|
||||
"catalogRestoreFailed": "Не удалось восстановить встроенные записи",
|
||||
"errorDockerCliMissing": "На хосте не установлен Docker CLI / Engine — контейнерные плагины не могут запуститься",
|
||||
"errorDockerDaemonUnavailable": "Служба Docker не запущена или у текущего пользователя нет доступа к docker.sock",
|
||||
"errorDockerComposeMissing": "На хосте отсутствует плагин Docker Compose v2",
|
||||
"errorDockerEngineUnsupported": "Версия Docker Engine не соответствует требованиям изоляции",
|
||||
"errorDockerSocketMissing": "В контейнере не смонтирован /var/run/docker.sock",
|
||||
"errorGitMissing": "На хосте не установлен Git",
|
||||
"errorInstallFailed": "Ошибка установки плагина; проверьте логи или передайте диагностику CSAI Agent",
|
||||
"driverNowReady": "Драйвер готов — можно продолжать установку в один клик",
|
||||
"driverMissingBtn": "Отсутствует драйвер — сначала установите зависимость",
|
||||
"driverMissingTitle": "На хосте отсутствует необходимый драйвер: {driver}",
|
||||
"askAgentInstallDriver": "Установить через CSAI Agent",
|
||||
"askAgentTroubleshoot": "Диагностика и исправление через Agent",
|
||||
"agentFixBtn": "Починить Agent",
|
||||
"officialDownload": "Официальная загрузка",
|
||||
"recheckDriver": "Проверить снова",
|
||||
"retryInstallOrStart": "Повторить установку / запуск",
|
||||
"handoffToAgent": "Задача установки передана CSAI Agent — переход в чат…",
|
||||
"handoffTroubleshoot": "Задача диагностики передана CSAI Agent — переход в чат…"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5996,8 +5996,8 @@
|
|||
"notReady": "未就绪",
|
||||
"available": "可用",
|
||||
"unavailable": "不可用",
|
||||
"dockerInstallLinuxHint": "Linux / Kali 宿主可在确认提权后通过发行版官方源安装 docker.io / docker-ce 与 docker-compose-plugin 并启动 dockerd,完成后点击上方「重新检测」;或优先使用 Release / Git 原生驱动。",
|
||||
"dockerInstallDesktopHint": "macOS / Windows 请先安装并启动 Docker Desktop(或 OrbStack / WSL2 Docker),或选择 Release / Git 原生驱动。",
|
||||
"dockerInstallLinuxHint": "Linux / Kali 宿主可直接点击上方「交给 CSAI Agent 自动安装配置」,或手动安装 docker.io 与 docker-compose-plugin 并启动 dockerd,完成后点击「重新检测」。",
|
||||
"dockerInstallDesktopHint": "macOS / Windows 可点击「官方下载」安装并启动 Docker Desktop(或交给 Agent 通过 Homebrew/winget 协助安装),也可优先选择 Release / Git 原生驱动。",
|
||||
"confirmUninstallTitle": "卸载插件「{{name}}」?",
|
||||
"confirmUninstallDesc": "将停止插件进程/容器、撤销代理会话与模型网关 Token,并退役隔离端口。",
|
||||
"purgeDataOption": "同时删除持久化运行数据与卷(默认保留数据)",
|
||||
|
|
@ -6064,6 +6064,24 @@
|
|||
"catalogDeleted": "已从能力市场移除",
|
||||
"catalogDeleteFailed": "删除市场条目失败",
|
||||
"catalogRestored": "已恢复全部默认精选目录",
|
||||
"catalogRestoreFailed": "恢复默认精选失败"
|
||||
"catalogRestoreFailed": "恢复默认精选失败",
|
||||
"errorDockerCliMissing": "宿主未安装 Docker CLI / Engine,容器类插件无法启动",
|
||||
"errorDockerDaemonUnavailable": "宿主 Docker 服务未启动,或当前运行用户无权访问 docker.sock",
|
||||
"errorDockerComposeMissing": "宿主缺少 Docker Compose v2 插件",
|
||||
"errorDockerEngineUnsupported": "宿主 Docker Engine 版本过低或不满足隔离档位要求",
|
||||
"errorDockerSocketMissing": "容器内未挂载 /var/run/docker.sock",
|
||||
"errorGitMissing": "宿主未安装 Git 工具",
|
||||
"errorInstallFailed": "插件安装失败,请查看运行日志或交给 Agent 排错修复",
|
||||
"driverNowReady": "运行驱动已就绪,可以继续一键安装",
|
||||
"driverMissingBtn": "缺少运行驱动,请先安装依赖",
|
||||
"driverMissingTitle": "当前宿主机缺少所需驱动:{driver}",
|
||||
"askAgentInstallDriver": "交给 CSAI Agent 自动安装配置",
|
||||
"askAgentTroubleshoot": "交给 CSAI Agent 排错并修复",
|
||||
"agentFixBtn": "Agent 排错",
|
||||
"officialDownload": "官方下载",
|
||||
"recheckDriver": "重新检测",
|
||||
"retryInstallOrStart": "重试安装 / 启动",
|
||||
"handoffToAgent": "已将安装任务交给 CSAI Agent,正在跳转对话工作台…",
|
||||
"handoffTroubleshoot": "已将排错与修复任务交给 CSAI Agent,正在跳转对话工作台…"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue