feat(pluginhub): support adding, deleting, and restoring market catalog entries
This commit is contained in:
parent
0a0dcb51db
commit
2c107dc80a
|
|
@ -0,0 +1,81 @@
|
|||
package database
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
type PluginCatalogRecord struct {
|
||||
ID string
|
||||
Title string
|
||||
Repository string
|
||||
Revision string
|
||||
Summary string
|
||||
ManifestJSON string
|
||||
Source string // "custom" | "builtin_hidden"
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
func (db *DB) ListPluginCatalogRecords(ctx context.Context) ([]PluginCatalogRecord, error) {
|
||||
rows, err := db.QueryContext(ctx, `SELECT id, title, repository, revision, summary, manifest_json, source, created_at, updated_at
|
||||
FROM plugin_catalog_entries ORDER BY updated_at DESC, id ASC`)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
out := []PluginCatalogRecord{}
|
||||
for rows.Next() {
|
||||
var r PluginCatalogRecord
|
||||
if err := rows.Scan(&r.ID, &r.Title, &r.Repository, &r.Revision, &r.Summary, &r.ManifestJSON, &r.Source, &r.CreatedAt, &r.UpdatedAt); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out = append(out, r)
|
||||
}
|
||||
return out, rows.Err()
|
||||
}
|
||||
|
||||
func (db *DB) GetPluginCatalogRecord(ctx context.Context, id string) (PluginCatalogRecord, error) {
|
||||
var r PluginCatalogRecord
|
||||
err := db.QueryRowContext(ctx, `SELECT id, title, repository, revision, summary, manifest_json, source, created_at, updated_at
|
||||
FROM plugin_catalog_entries WHERE id = ?`, id).
|
||||
Scan(&r.ID, &r.Title, &r.Repository, &r.Revision, &r.Summary, &r.ManifestJSON, &r.Source, &r.CreatedAt, &r.UpdatedAt)
|
||||
return r, err
|
||||
}
|
||||
|
||||
func (db *DB) UpsertPluginCatalogRecord(ctx context.Context, r PluginCatalogRecord) error {
|
||||
now := time.Now().UTC()
|
||||
if r.Source == "" {
|
||||
r.Source = "custom"
|
||||
}
|
||||
_, err := db.ExecContext(ctx, `INSERT INTO plugin_catalog_entries
|
||||
(id, title, repository, revision, summary, manifest_json, source, created_at, updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
ON CONFLICT(id) DO UPDATE SET
|
||||
title=excluded.title,
|
||||
repository=excluded.repository,
|
||||
revision=excluded.revision,
|
||||
summary=excluded.summary,
|
||||
manifest_json=excluded.manifest_json,
|
||||
source=excluded.source,
|
||||
updated_at=excluded.updated_at`,
|
||||
r.ID, r.Title, r.Repository, r.Revision, r.Summary, r.ManifestJSON, r.Source, now, now)
|
||||
return err
|
||||
}
|
||||
|
||||
func (db *DB) DeletePluginCatalogRecord(ctx context.Context, id string) (bool, error) {
|
||||
res, err := db.ExecContext(ctx, `DELETE FROM plugin_catalog_entries WHERE id = ?`, id)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
n, err := res.RowsAffected()
|
||||
return n > 0, err
|
||||
}
|
||||
|
||||
func (db *DB) RestoreHiddenBuiltinCatalog(ctx context.Context) (int64, error) {
|
||||
res, err := db.ExecContext(ctx, `DELETE FROM plugin_catalog_entries WHERE source = 'builtin_hidden'`)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return res.RowsAffected()
|
||||
}
|
||||
|
|
@ -1227,6 +1227,18 @@ CREATE TABLE IF NOT EXISTS plugin_operations (
|
|||
CREATE UNIQUE INDEX IF NOT EXISTS idx_plugin_operations_active ON plugin_operations(install_id)
|
||||
WHERE status IN ('queued', 'running');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS plugin_catalog_entries (
|
||||
id TEXT PRIMARY KEY,
|
||||
title TEXT NOT NULL,
|
||||
repository TEXT NOT NULL,
|
||||
revision TEXT NOT NULL DEFAULT '',
|
||||
summary TEXT NOT NULL DEFAULT '',
|
||||
manifest_json TEXT NOT NULL DEFAULT '',
|
||||
source TEXT NOT NULL DEFAULT 'custom' CHECK(source IN ('custom','builtin_hidden')),
|
||||
created_at DATETIME NOT NULL,
|
||||
updated_at DATETIME NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS plugin_runtime_leases (
|
||||
id INTEGER PRIMARY KEY CHECK(id = 1),
|
||||
owner TEXT NOT NULL,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import (
|
|||
"cyberstrike-ai/internal/audit"
|
||||
"cyberstrike-ai/internal/database"
|
||||
"cyberstrike-ai/internal/pluginhub"
|
||||
"cyberstrike-ai/internal/pluginhub/catalog"
|
||||
"cyberstrike-ai/internal/pluginhub/llmgateway"
|
||||
"cyberstrike-ai/internal/pluginhub/manifest"
|
||||
"cyberstrike-ai/internal/pluginhub/source"
|
||||
|
|
@ -54,6 +53,9 @@ func (h *PluginHandler) Register(group *gin.RouterGroup) {
|
|||
c.Next()
|
||||
})
|
||||
group.GET("/catalog", h.listCatalog)
|
||||
group.POST("/catalog", h.saveCatalog)
|
||||
group.DELETE("/catalog/:id", h.deleteCatalog)
|
||||
group.POST("/catalog/restore", h.restoreCatalog)
|
||||
group.GET("/schemas/:name", h.schema)
|
||||
group.GET("/llm/channels", h.listLLMChannels)
|
||||
group.GET("/installs", h.listInstalls)
|
||||
|
|
@ -111,7 +113,54 @@ func (h *PluginHandler) patchLLM(c *gin.Context) {
|
|||
}
|
||||
|
||||
func (h *PluginHandler) listCatalog(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{"items": catalog.Entries()})
|
||||
items, hiddenBuiltins, err := h.hub.ListCatalog(c.Request.Context())
|
||||
if err != nil {
|
||||
pluginError(c, http.StatusInternalServerError, "plugin_storage_error")
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"items": items, "hidden_builtins": hiddenBuiltins})
|
||||
}
|
||||
|
||||
func (h *PluginHandler) saveCatalog(c *gin.Context) {
|
||||
var input pluginhub.CatalogInput
|
||||
if !bindPluginRequest(c, &input) {
|
||||
return
|
||||
}
|
||||
entry, err := h.hub.SaveCatalogEntry(c.Request.Context(), input)
|
||||
if err != nil {
|
||||
pluginLifecycleError(c, err)
|
||||
return
|
||||
}
|
||||
if h.audit != nil {
|
||||
h.audit.RecordOK(c, "plugins", "catalog_save", "Plugin catalog entry saved", "plugin_catalog", entry.ID,
|
||||
map[string]interface{}{"repository": entry.Repository, "availability": entry.Availability})
|
||||
}
|
||||
c.JSON(http.StatusCreated, gin.H{"item": entry})
|
||||
}
|
||||
|
||||
func (h *PluginHandler) deleteCatalog(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
if err := h.hub.DeleteCatalogEntry(c.Request.Context(), id); err != nil {
|
||||
pluginLifecycleError(c, err)
|
||||
return
|
||||
}
|
||||
if h.audit != nil {
|
||||
h.audit.RecordOK(c, "plugins", "catalog_delete", "Plugin catalog entry removed", "plugin_catalog", id, nil)
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"deleted": id})
|
||||
}
|
||||
|
||||
func (h *PluginHandler) restoreCatalog(c *gin.Context) {
|
||||
restored, err := h.hub.RestoreBuiltinCatalog(c.Request.Context())
|
||||
if err != nil {
|
||||
pluginError(c, http.StatusInternalServerError, "plugin_storage_error")
|
||||
return
|
||||
}
|
||||
if h.audit != nil {
|
||||
h.audit.RecordOK(c, "plugins", "catalog_restore", "Built-in plugin catalog entries restored", "plugin_catalog", "builtin",
|
||||
map[string]interface{}{"restored": restored})
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"restored": restored})
|
||||
}
|
||||
|
||||
func (h *PluginHandler) schema(c *gin.Context) {
|
||||
|
|
|
|||
|
|
@ -123,6 +123,30 @@ func TestPluginManagementPreviewAndRBAC(t *testing.T) {
|
|||
request(http.MethodGet, "/catalog", "cookie:"+admin, "", http.StatusUnauthorized)
|
||||
request(http.MethodGet, "/catalog", reader, "", http.StatusOK)
|
||||
request(http.MethodGet, "/catalog", userWithoutPlugins, "", http.StatusForbidden)
|
||||
// Catalog CRUD & RBAC
|
||||
customBody := `{"id":"custom-tool","title":"Custom Tool","repository":"https://github.com/example/custom-tool","revision":"main","summary":"Custom market entry"}`
|
||||
request(http.MethodPost, "/catalog", reader, customBody, http.StatusForbidden)
|
||||
request(http.MethodPost, "/catalog", scopedManager, customBody, http.StatusForbidden)
|
||||
request(http.MethodPost, "/catalog", admin, customBody, http.StatusCreated)
|
||||
catalogRaw := request(http.MethodGet, "/catalog", reader, "", http.StatusOK)
|
||||
if !strings.Contains(string(catalogRaw), `"custom-tool"`) {
|
||||
t.Fatalf("expected custom-tool in catalog: %s", catalogRaw)
|
||||
}
|
||||
request(http.MethodDelete, "/catalog/custom-tool", reader, "", http.StatusForbidden)
|
||||
request(http.MethodDelete, "/catalog/custom-tool", admin, "", http.StatusOK)
|
||||
request(http.MethodDelete, "/catalog/custom-tool", admin, "", http.StatusNotFound)
|
||||
// Hiding and restoring a built-in catalog entry
|
||||
request(http.MethodDelete, "/catalog/artex", admin, "", http.StatusOK)
|
||||
hiddenRaw := request(http.MethodGet, "/catalog", reader, "", http.StatusOK)
|
||||
if strings.Contains(string(hiddenRaw), `"id":"artex"`) || !strings.Contains(string(hiddenRaw), `"hidden_builtins":1`) {
|
||||
t.Fatalf("expected artex hidden with hidden_builtins=1: %s", hiddenRaw)
|
||||
}
|
||||
request(http.MethodPost, "/catalog/restore", reader, `{}`, http.StatusForbidden)
|
||||
request(http.MethodPost, "/catalog/restore", admin, `{}`, http.StatusOK)
|
||||
restoredRaw := request(http.MethodGet, "/catalog", reader, "", http.StatusOK)
|
||||
if !strings.Contains(string(restoredRaw), `"id":"artex"`) || !strings.Contains(string(restoredRaw), `"hidden_builtins":0`) {
|
||||
t.Fatalf("expected artex restored: %s", restoredRaw)
|
||||
}
|
||||
request(http.MethodGet, "/schemas/manifest-v1", reader, "", http.StatusOK)
|
||||
body := `{"repository":"https://github.com/example/review","revision":"v1.0.0"}`
|
||||
request(http.MethodPost, "/imports/inspect", reader, body, http.StatusForbidden)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ type Entry struct {
|
|||
Revision string `json:"revision"`
|
||||
Summary string `json:"summary"`
|
||||
Availability string `json:"availability"`
|
||||
Builtin bool `json:"builtin"`
|
||||
}
|
||||
|
||||
func Entries() []Entry {
|
||||
|
|
@ -26,18 +27,29 @@ func Entries() []Entry {
|
|||
Repository: "https://github.com/RuoJi6/ARTEX",
|
||||
Summary: "AI autonomous penetration testing platform (Go + Next.js + PostgreSQL) with CSAI LLM gateway reuse.",
|
||||
Availability: "plan_available",
|
||||
Builtin: true,
|
||||
},
|
||||
{ID: "static-web", Title: "Static Web Runtime Check", Repository: "https://github.com/nginx/docker-nginx-unprivileged",
|
||||
Summary: "Unprivileged static WebUI for lifecycle verification.", Availability: "plan_available"},
|
||||
Summary: "Unprivileged static WebUI for lifecycle verification.", Availability: "plan_available", Builtin: true},
|
||||
{
|
||||
ID: "librechat", Title: "LibreChat", Repository: "https://github.com/LibreChat-AI/LibreChat",
|
||||
Revision: "566e20b613389600a7975fd8f7c1bffbe54f06c8",
|
||||
Summary: "Self-hosted chat WebUI used for plugin platform interoperability verification.",
|
||||
Availability: "inspection_only",
|
||||
Builtin: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func HasBuiltin(id string) bool {
|
||||
for _, entry := range Entries() {
|
||||
if entry.ID == id {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func Manifest(id string) ([]byte, bool) {
|
||||
switch id {
|
||||
case "artex":
|
||||
|
|
|
|||
|
|
@ -0,0 +1,176 @@
|
|||
package pluginhub
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"cyberstrike-ai/internal/database"
|
||||
"cyberstrike-ai/internal/pluginhub/catalog"
|
||||
"cyberstrike-ai/internal/pluginhub/manifest"
|
||||
"cyberstrike-ai/internal/pluginhub/source"
|
||||
)
|
||||
|
||||
var catalogIDPattern = regexp.MustCompile(`^[a-z][a-z0-9-]{1,47}$`)
|
||||
|
||||
type CatalogInput struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Repository string `json:"repository"`
|
||||
Revision string `json:"revision"`
|
||||
Summary string `json:"summary"`
|
||||
Manifest string `json:"manifest"` // Optional YAML or JSON manifest for one-click install
|
||||
}
|
||||
|
||||
func (m *Manager) ListCatalog(ctx context.Context) ([]catalog.Entry, int, error) {
|
||||
records, err := m.db.ListPluginCatalogRecords(ctx)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
byID := make(map[string]database.PluginCatalogRecord, len(records))
|
||||
hiddenBuiltins := 0
|
||||
for _, r := range records {
|
||||
byID[r.ID] = r
|
||||
if r.Source == "builtin_hidden" && catalog.HasBuiltin(r.ID) {
|
||||
hiddenBuiltins++
|
||||
}
|
||||
}
|
||||
result := make([]catalog.Entry, 0, len(catalog.Entries())+len(records))
|
||||
seen := map[string]bool{}
|
||||
for _, entry := range catalog.Entries() {
|
||||
seen[entry.ID] = true
|
||||
if override, ok := byID[entry.ID]; ok {
|
||||
if override.Source == "builtin_hidden" {
|
||||
continue
|
||||
}
|
||||
avail := "inspection_only"
|
||||
if strings.TrimSpace(override.ManifestJSON) != "" {
|
||||
avail = "plan_available"
|
||||
}
|
||||
result = append(result, catalog.Entry{
|
||||
ID: override.ID, Title: override.Title, Repository: override.Repository,
|
||||
Revision: override.Revision, Summary: override.Summary, Availability: avail, Builtin: false,
|
||||
})
|
||||
continue
|
||||
}
|
||||
result = append(result, entry)
|
||||
}
|
||||
for _, r := range records {
|
||||
if seen[r.ID] || r.Source != "custom" {
|
||||
continue
|
||||
}
|
||||
avail := "inspection_only"
|
||||
if strings.TrimSpace(r.ManifestJSON) != "" {
|
||||
avail = "plan_available"
|
||||
}
|
||||
result = append(result, catalog.Entry{
|
||||
ID: r.ID, Title: r.Title, Repository: r.Repository,
|
||||
Revision: r.Revision, Summary: r.Summary, Availability: avail, Builtin: false,
|
||||
})
|
||||
}
|
||||
return result, hiddenBuiltins, nil
|
||||
}
|
||||
|
||||
func (m *Manager) CatalogManifest(ctx context.Context, id string) ([]byte, bool) {
|
||||
if r, err := m.db.GetPluginCatalogRecord(ctx, id); err == nil {
|
||||
if r.Source == "builtin_hidden" {
|
||||
return nil, false
|
||||
}
|
||||
if strings.TrimSpace(r.ManifestJSON) != "" {
|
||||
return []byte(r.ManifestJSON), true
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
return catalog.Manifest(id)
|
||||
}
|
||||
|
||||
func (m *Manager) SaveCatalogEntry(ctx context.Context, input CatalogInput) (catalog.Entry, error) {
|
||||
id := strings.TrimSpace(input.ID)
|
||||
title := strings.TrimSpace(input.Title)
|
||||
repoRaw := strings.TrimSpace(input.Repository)
|
||||
rev := strings.TrimSpace(input.Revision)
|
||||
summary := strings.TrimSpace(input.Summary)
|
||||
manifestRaw := strings.TrimSpace(input.Manifest)
|
||||
|
||||
var manifestCanonical string
|
||||
var manifestRepo string
|
||||
if manifestRaw != "" {
|
||||
decl, err := manifest.DecodeDeclaration([]byte(manifestRaw))
|
||||
if err != nil {
|
||||
return catalog.Entry{}, ErrInvalidManifest
|
||||
}
|
||||
manifestCanonical = string(decl.Canonical)
|
||||
manifestRepo = decl.Metadata.Repository
|
||||
if id == "" {
|
||||
id = decl.Metadata.ID
|
||||
} else if id != decl.Metadata.ID {
|
||||
return catalog.Entry{}, ErrInvalidManifest
|
||||
}
|
||||
if title == "" {
|
||||
title = decl.Metadata.Title
|
||||
}
|
||||
if repoRaw == "" {
|
||||
repoRaw = decl.Metadata.Repository
|
||||
}
|
||||
if summary == "" {
|
||||
summary = decl.Metadata.Summary
|
||||
}
|
||||
}
|
||||
|
||||
if !catalogIDPattern.MatchString(id) || title == "" || len(title) > 100 || len(summary) > 500 {
|
||||
return catalog.Entry{}, ErrInvalidRequest
|
||||
}
|
||||
repo, err := source.NormalizeGitHubRepository(repoRaw)
|
||||
if err != nil {
|
||||
return catalog.Entry{}, ErrSourceMismatch
|
||||
}
|
||||
if manifestRepo != "" {
|
||||
if normManifestRepo, err := source.NormalizeGitHubRepository(manifestRepo); err == nil && normManifestRepo != repo {
|
||||
return catalog.Entry{}, ErrSourceMismatch
|
||||
}
|
||||
}
|
||||
if rev != "" && manifest.ValidateGitRef(rev) != nil {
|
||||
return catalog.Entry{}, ErrInvalidRequest
|
||||
}
|
||||
if err := m.db.UpsertPluginCatalogRecord(ctx, database.PluginCatalogRecord{
|
||||
ID: id, Title: title, Repository: repo, Revision: rev, Summary: summary,
|
||||
ManifestJSON: manifestCanonical, Source: "custom",
|
||||
}); err != nil {
|
||||
return catalog.Entry{}, err
|
||||
}
|
||||
avail := "inspection_only"
|
||||
if manifestCanonical != "" {
|
||||
avail = "plan_available"
|
||||
}
|
||||
return catalog.Entry{
|
||||
ID: id, Title: title, Repository: repo, Revision: rev,
|
||||
Summary: summary, Availability: avail, Builtin: false,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (m *Manager) DeleteCatalogEntry(ctx context.Context, id string) error {
|
||||
id = strings.TrimSpace(id)
|
||||
if !catalogIDPattern.MatchString(id) {
|
||||
return ErrInvalidRequest
|
||||
}
|
||||
if catalog.HasBuiltin(id) {
|
||||
// Hide built-in catalog entries via tombstone so they disappear from the market
|
||||
// while remaining restorable if the operator chooses to restore defaults.
|
||||
return m.db.UpsertPluginCatalogRecord(ctx, database.PluginCatalogRecord{
|
||||
ID: id, Title: id, Repository: "", Source: "builtin_hidden",
|
||||
})
|
||||
}
|
||||
deleted, err := m.db.DeletePluginCatalogRecord(ctx, id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !deleted {
|
||||
return sql.ErrNoRows
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Manager) RestoreBuiltinCatalog(ctx context.Context) (int64, error) {
|
||||
return m.db.RestoreHiddenBuiltinCatalog(ctx)
|
||||
}
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
package pluginhub
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"cyberstrike-ai/internal/config"
|
||||
"cyberstrike-ai/internal/database"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func TestCatalogStoreCRUDAndRestore(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
db, err := database.NewDB(filepath.Join(t.TempDir(), "catalog.db"), zap.NewNop())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() { _ = db.Close() })
|
||||
|
||||
mgr, err := New(db, config.PluginsConfig{}, t.TempDir(), zap.NewNop())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Built-in entries present initially
|
||||
initial, hidden, err := mgr.ListCatalog(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(initial) < 3 || hidden != 0 {
|
||||
t.Fatalf("expected >=3 built-ins and 0 hidden, got %d / %d", len(initial), hidden)
|
||||
}
|
||||
|
||||
// Add custom inspection-only entry
|
||||
entry, err := mgr.SaveCatalogEntry(ctx, CatalogInput{
|
||||
ID: "my-scanner",
|
||||
Title: "My Scanner",
|
||||
Repository: "https://github.com/example/my-scanner.git",
|
||||
Revision: "main",
|
||||
Summary: "Custom security scanner",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("save inspection-only entry: %v", err)
|
||||
}
|
||||
if entry.ID != "my-scanner" || entry.Repository != "https://github.com/example/my-scanner" || entry.Availability != "inspection_only" || entry.Builtin {
|
||||
t.Fatalf("unexpected saved entry: %+v", entry)
|
||||
}
|
||||
|
||||
// Add custom entry with YAML manifest -> plan_available
|
||||
raw, err := os.ReadFile("manifest/testdata/web-plugin.yaml")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
rawStr := strings.ReplaceAll(string(raw), "https://git.example.org/examples/log-review-demo.git", "https://github.com/example/log-review-demo")
|
||||
withManifest, err := mgr.SaveCatalogEntry(ctx, CatalogInput{
|
||||
Manifest: rawStr,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("save manifest entry: %v", err)
|
||||
}
|
||||
if withManifest.ID != "log-review" || withManifest.Availability != "plan_available" {
|
||||
t.Fatalf("unexpected manifest entry: %+v", withManifest)
|
||||
}
|
||||
if rawManifest, ok := mgr.CatalogManifest(ctx, "log-review"); !ok || len(rawManifest) == 0 {
|
||||
t.Fatalf("expected CatalogManifest to resolve custom manifest")
|
||||
}
|
||||
|
||||
// Mismatched repository vs manifest must fail
|
||||
if _, err := mgr.SaveCatalogEntry(ctx, CatalogInput{
|
||||
Repository: "https://github.com/other/repo",
|
||||
Manifest: rawStr,
|
||||
}); !errors.Is(err, ErrSourceMismatch) {
|
||||
t.Fatalf("expected ErrSourceMismatch, got %v", err)
|
||||
}
|
||||
|
||||
// Delete custom entry -> hard deleted
|
||||
if err := mgr.DeleteCatalogEntry(ctx, "my-scanner"); err != nil {
|
||||
t.Fatalf("delete custom entry: %v", err)
|
||||
}
|
||||
if err := mgr.DeleteCatalogEntry(ctx, "my-scanner"); !errors.Is(err, sql.ErrNoRows) {
|
||||
t.Fatalf("expected sql.ErrNoRows on second delete, got %v", err)
|
||||
}
|
||||
|
||||
// Delete built-in entry -> hidden tombstone, hidden_builtins increments, manifest inaccessible
|
||||
if err := mgr.DeleteCatalogEntry(ctx, "artex"); err != nil {
|
||||
t.Fatalf("hide built-in entry: %v", err)
|
||||
}
|
||||
afterHide, hidden, err := mgr.ListCatalog(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if hidden != 1 {
|
||||
t.Fatalf("expected hidden_builtins=1, got %d", hidden)
|
||||
}
|
||||
for _, item := range afterHide {
|
||||
if item.ID == "artex" {
|
||||
t.Fatalf("expected artex to be hidden")
|
||||
}
|
||||
}
|
||||
if _, ok := mgr.CatalogManifest(ctx, "artex"); ok {
|
||||
t.Fatalf("expected hidden built-in manifest to be unavailable")
|
||||
}
|
||||
|
||||
// Restore hidden built-ins
|
||||
restored, err := mgr.RestoreBuiltinCatalog(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if restored != 1 {
|
||||
t.Fatalf("expected 1 restored, got %d", restored)
|
||||
}
|
||||
afterRestore, hidden, err := mgr.ListCatalog(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if hidden != 0 {
|
||||
t.Fatalf("expected hidden_builtins=0 after restore, got %d", hidden)
|
||||
}
|
||||
foundArtex := false
|
||||
for _, item := range afterRestore {
|
||||
if item.ID == "artex" {
|
||||
foundArtex = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !foundArtex {
|
||||
t.Fatalf("expected artex to reappear after restore")
|
||||
}
|
||||
}
|
||||
|
|
@ -13,7 +13,6 @@ import (
|
|||
|
||||
"cyberstrike-ai/internal/config"
|
||||
"cyberstrike-ai/internal/database"
|
||||
"cyberstrike-ai/internal/pluginhub/catalog"
|
||||
"cyberstrike-ai/internal/pluginhub/manifest"
|
||||
"cyberstrike-ai/internal/pluginhub/source"
|
||||
|
||||
|
|
@ -73,7 +72,7 @@ func (m *Manager) CreatePlan(ctx context.Context, request PlanRequest) (PlanResu
|
|||
if len(request.Manifest) != 0 {
|
||||
return PlanResult{}, ErrInvalidRequest
|
||||
}
|
||||
data, ok := catalog.Manifest(request.CatalogID)
|
||||
data, ok := m.CatalogManifest(ctx, request.CatalogID)
|
||||
if !ok {
|
||||
return PlanResult{}, ErrCatalogManifest
|
||||
}
|
||||
|
|
|
|||
|
|
@ -222,7 +222,11 @@ func pluginPermission(method, path string) string {
|
|||
switch path {
|
||||
case "/plugins/installs/:id/embed-sessions":
|
||||
return "plugins:use"
|
||||
case "/plugins/imports/inspect", "/plugins/install-plans", "/plugins/installs", "/plugins/installs/:id/operations":
|
||||
case "/plugins/catalog", "/plugins/catalog/restore", "/plugins/imports/inspect", "/plugins/install-plans", "/plugins/installs", "/plugins/installs/:id/operations":
|
||||
return "plugins:manage"
|
||||
}
|
||||
case http.MethodDelete:
|
||||
if path == "/plugins/catalog/:id" {
|
||||
return "plugins:manage"
|
||||
}
|
||||
case http.MethodPatch:
|
||||
|
|
|
|||
|
|
@ -165,7 +165,184 @@ export function PlanApprovalDrawer({ planResponse, channels, visible, onCancel,
|
|||
);
|
||||
}
|
||||
|
||||
export function ImportGitDrawer({ visible, onCancel, onPlanReady }) {
|
||||
export function AddCatalogDrawer({ visible, onCancel, onSaved }) {
|
||||
const t = useT();
|
||||
const [repository, setRepository] = useState('');
|
||||
const [revision, setRevision] = useState('');
|
||||
const [id, setId] = useState('');
|
||||
const [title, setTitle] = useState('');
|
||||
const [summary, setSummary] = useState('');
|
||||
const [manifestText, setManifestText] = useState('');
|
||||
const [inspecting, setInspecting] = useState(false);
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (visible) {
|
||||
setRepository('');
|
||||
setRevision('');
|
||||
setId('');
|
||||
setTitle('');
|
||||
setSummary('');
|
||||
setManifestText('');
|
||||
}
|
||||
}, [visible]);
|
||||
|
||||
const inferFromRepo = repoValue => {
|
||||
const cleaned = String(repoValue || '').trim().replace(/\.git$/i, '').replace(/\/+$/, '');
|
||||
const seg = cleaned.split('/').pop() || '';
|
||||
const slug = seg.toLowerCase().replace(/[^a-z0-9-]+/g, '-').replace(/^-+|-+$/g, '');
|
||||
return { seg, slug };
|
||||
};
|
||||
|
||||
const handleRepoChange = value => {
|
||||
setRepository(value);
|
||||
const { seg, slug } = inferFromRepo(value);
|
||||
if (!id && slug && /^[a-z]/.test(slug)) setId(slug);
|
||||
if (!title && seg) setTitle(seg);
|
||||
};
|
||||
|
||||
const handleProbe = async () => {
|
||||
if (!repository.trim()) return;
|
||||
setInspecting(true);
|
||||
try {
|
||||
const res = await pluginApi.inspectGit(repository, revision);
|
||||
const info = res?.inspection;
|
||||
if (info?.repository) setRepository(info.repository);
|
||||
if (info?.manifest) {
|
||||
const m = info.manifest;
|
||||
if (m.metadata?.id) setId(m.metadata.id);
|
||||
if (m.metadata?.title) setTitle(m.metadata.title);
|
||||
if (m.metadata?.summary) setSummary(m.metadata.summary);
|
||||
setManifestText(JSON.stringify(m, null, 2));
|
||||
toastSuccess(t('pluginHub.catalogProbeWithManifest', null, '已探测到仓库自带 Manifest,保存后支持一键安装'));
|
||||
} else {
|
||||
const { seg, slug } = inferFromRepo(info?.repository || repository);
|
||||
if (!id && slug && /^[a-z]/.test(slug)) setId(slug);
|
||||
if (!title && seg) setTitle(seg);
|
||||
toastSuccess(t('pluginHub.catalogProbeSuccess', null, '仓库只读探测完成,已自动填充基础信息'));
|
||||
}
|
||||
} catch (err) {
|
||||
toastError(pluginErrorText(t, err, t('pluginHub.inspectFailed', null, '探测仓库失败')));
|
||||
} finally {
|
||||
setInspecting(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleSave = async () => {
|
||||
if (!repository.trim() && !manifestText.trim()) {
|
||||
toastError(t('pluginHub.catalogRepoRequired', null, '请填写 GitHub 仓库地址或提供 Manifest'));
|
||||
return;
|
||||
}
|
||||
setSaving(true);
|
||||
try {
|
||||
const res = await pluginApi.saveCatalog({
|
||||
id: id.trim(),
|
||||
title: title.trim(),
|
||||
repository: repository.trim(),
|
||||
revision: revision.trim(),
|
||||
summary: summary.trim(),
|
||||
manifest: manifestText.trim()
|
||||
});
|
||||
toastSuccess(t('pluginHub.catalogSaved', null, '已保存到能力市场'));
|
||||
onSaved?.(res?.item);
|
||||
} catch (err) {
|
||||
toastError(pluginErrorText(t, err, t('pluginHub.catalogSaveFailed', null, '保存到能力市场失败')));
|
||||
} finally {
|
||||
setSaving(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Drawer
|
||||
title={t('pluginHub.addCatalogTitle', null, '新增能力市场插件')}
|
||||
visible={visible}
|
||||
onCancel={onCancel}
|
||||
width={680}
|
||||
footer={
|
||||
<Space>
|
||||
<Button onClick={onCancel}>{t('common.cancel', null, '取消')}</Button>
|
||||
<Button theme="solid" type="primary" loading={saving} onClick={handleSave}>
|
||||
{t('pluginHub.saveToMarket', null, '保存到能力市场')}
|
||||
</Button>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<div className="cs-ph-drawer-stack">
|
||||
<Paragraph type="tertiary" style={{ margin: 0 }}>
|
||||
{t('pluginHub.addCatalogDesc', null, '将公开 GitHub 仓库收录到本机能力市场。留空 Manifest 将以「支持探测导入」模式展示;提供合法 YAML/JSON Manifest 后将直接支持「一键下载安装」。')}
|
||||
</Paragraph>
|
||||
<Space style={{ width: '100%' }} align="end" wrap>
|
||||
<div style={{ flex: 2, minWidth: 260 }}>
|
||||
<Text strong size="small">{t('pluginHub.repositoryURL', null, 'GitHub 仓库地址')}</Text>
|
||||
<Input
|
||||
value={repository}
|
||||
onChange={handleRepoChange}
|
||||
placeholder="https://github.com/owner/repo"
|
||||
style={{ marginTop: 4 }}
|
||||
/>
|
||||
</div>
|
||||
<div style={{ flex: 1, minWidth: 130 }}>
|
||||
<Text strong size="small">{t('pluginHub.revisionOptional', null, '分支 / Tag(可选)')}</Text>
|
||||
<Input
|
||||
value={revision}
|
||||
onChange={setRevision}
|
||||
placeholder="main / v1.0.0"
|
||||
style={{ marginTop: 4 }}
|
||||
/>
|
||||
</div>
|
||||
<Button loading={inspecting} onClick={handleProbe} disabled={!repository.trim()}>
|
||||
{t('pluginHub.probeAndFill', null, '探测并自动填充')}
|
||||
</Button>
|
||||
</Space>
|
||||
|
||||
<Space style={{ width: '100%' }} wrap>
|
||||
<div style={{ flex: 1, minWidth: 220 }}>
|
||||
<Text strong size="small">{t('pluginHub.pluginId', null, '插件标识 ID')}</Text>
|
||||
<Input
|
||||
value={id}
|
||||
onChange={setId}
|
||||
placeholder="my-security-tool"
|
||||
style={{ marginTop: 4 }}
|
||||
/>
|
||||
</div>
|
||||
<div style={{ flex: 1, minWidth: 220 }}>
|
||||
<Text strong size="small">{t('pluginHub.pluginTitle', null, '显示名称')}</Text>
|
||||
<Input
|
||||
value={title}
|
||||
onChange={setTitle}
|
||||
placeholder="My Security Tool"
|
||||
style={{ marginTop: 4 }}
|
||||
/>
|
||||
</div>
|
||||
</Space>
|
||||
|
||||
<div>
|
||||
<Text strong size="small">{t('pluginHub.catalogSummaryLabel', null, '功能简介')}</Text>
|
||||
<Input
|
||||
value={summary}
|
||||
onChange={setSummary}
|
||||
placeholder={t('pluginHub.catalogSummaryPlaceholder', null, '简述该开源安全工具的用途、架构或特性')}
|
||||
style={{ marginTop: 4 }}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Text strong size="small">{t('pluginHub.catalogManifestOptional', null, '插件 Manifest(可选,支持 YAML 或 JSON)')}</Text>
|
||||
<TextArea
|
||||
className="cs-ph-code-editor"
|
||||
value={manifestText}
|
||||
onChange={setManifestText}
|
||||
placeholder={t('pluginHub.catalogManifestPlaceholder', null, '可选:粘贴 csai-plugin.yaml 或 JSON 声明;点击上方「探测并自动填充」可自动抓取仓库根目录的 csai-plugin.yaml')}
|
||||
autosize={{ minRows: 8, maxRows: 18 }}
|
||||
style={{ marginTop: 4 }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Drawer>
|
||||
);
|
||||
}
|
||||
|
||||
export function ImportGitDrawer({ visible, initialEntry, onCancel, onPlanReady, onCatalogSaved }) {
|
||||
const t = useT();
|
||||
const [repository, setRepository] = useState('');
|
||||
const [revision, setRevision] = useState('');
|
||||
|
|
@ -175,6 +352,16 @@ export function ImportGitDrawer({ visible, onCancel, onPlanReady }) {
|
|||
const [driver, setDriver] = useState('auto');
|
||||
const [isolation, setIsolation] = useState('standard');
|
||||
const [planning, setPlanning] = useState(false);
|
||||
const [savingCatalog, setSavingCatalog] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (visible && initialEntry?.repository) {
|
||||
setRepository(initialEntry.repository);
|
||||
setRevision(initialEntry.revision || '');
|
||||
setInspected(null);
|
||||
setManifestText('');
|
||||
}
|
||||
}, [visible, initialEntry]);
|
||||
|
||||
const handleInspect = async () => {
|
||||
if (!repository.trim()) return;
|
||||
|
|
@ -221,6 +408,24 @@ export function ImportGitDrawer({ visible, onCancel, onPlanReady }) {
|
|||
}
|
||||
};
|
||||
|
||||
const handleSaveToCatalog = async () => {
|
||||
if (!inspected?.inspection) return;
|
||||
setSavingCatalog(true);
|
||||
try {
|
||||
await pluginApi.saveCatalog({
|
||||
repository: inspected.inspection.repository || repository.trim(),
|
||||
revision: revision.trim(),
|
||||
manifest: manifestText.trim()
|
||||
});
|
||||
toastSuccess(t('pluginHub.catalogSaved', null, '已保存到能力市场'));
|
||||
onCatalogSaved?.();
|
||||
} catch (err) {
|
||||
toastError(pluginErrorText(t, err, t('pluginHub.catalogSaveFailed', null, '保存到能力市场失败')));
|
||||
} finally {
|
||||
setSavingCatalog(false);
|
||||
}
|
||||
};
|
||||
|
||||
const info = inspected?.inspection;
|
||||
|
||||
return (
|
||||
|
|
@ -232,6 +437,13 @@ export function ImportGitDrawer({ visible, onCancel, onPlanReady }) {
|
|||
footer={
|
||||
<Space>
|
||||
<Button onClick={onCancel}>{t('common.cancel', null, '取消')}</Button>
|
||||
<Button
|
||||
loading={savingCatalog}
|
||||
disabled={!inspected?.inspection || !manifestText.trim()}
|
||||
onClick={handleSaveToCatalog}
|
||||
>
|
||||
{t('pluginHub.saveToMarket', null, '保存到能力市场')}
|
||||
</Button>
|
||||
<Button
|
||||
theme="solid"
|
||||
type="primary"
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ export function newIdempotencyKey(prefix = 'op') {
|
|||
|
||||
const ERROR_KEYS = {
|
||||
plugin_bearer_required: ['pluginHub.errorBearerRequired', '需要 Bearer 登录凭据才能访问插件平台'],
|
||||
plugin_invalid_request: ['pluginHub.errorInvalidRequest', '请求参数不合法,请检查插件 ID(仅限小写字母、数字和连字符)、标题与仓库地址'],
|
||||
plugin_invalid_source: ['pluginHub.errorInvalidSource', '仅支持公开的 GitHub HTTPS 仓库地址及合法分支/Tag/Commit'],
|
||||
plugin_ambiguous_git_ref: ['pluginHub.errorAmbiguousRef', '分支与 Tag 同名,请填写完整引用(如 refs/tags/xxx 或 refs/heads/xxx)'],
|
||||
plugin_source_not_found: ['pluginHub.errorSourceNotFound', '未找到目标仓库或指定版本'],
|
||||
|
|
@ -83,6 +84,9 @@ export function driverLabel(t, driver) {
|
|||
|
||||
export const pluginApi = {
|
||||
listCatalog: () => api.get('/plugins/catalog'),
|
||||
saveCatalog: body => api.post('/plugins/catalog', body),
|
||||
deleteCatalog: id => api.del(`/plugins/catalog/${encodeURIComponent(id)}`),
|
||||
restoreCatalog: () => api.post('/plugins/catalog/restore', {}),
|
||||
listInstalls: () => api.get('/plugins/installs'),
|
||||
getInstall: id => api.get(`/plugins/installs/${encodeURIComponent(id)}`),
|
||||
listLLMChannels: () => api.get('/plugins/llm/channels'),
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import {
|
|||
import { formatDateTime } from '../../lib/format';
|
||||
import { driverLabel, pluginApi, pluginErrorText, stateColor, stateLabel } from './api';
|
||||
import WorkspaceView from './WorkspaceView';
|
||||
import { ImportGitDrawer, PlanApprovalDrawer, PluginDetailDrawer, RuntimeProbesDrawer } from './Drawers';
|
||||
import { AddCatalogDrawer, ImportGitDrawer, PlanApprovalDrawer, PluginDetailDrawer, RuntimeProbesDrawer } from './Drawers';
|
||||
import './page.css';
|
||||
|
||||
const { Text, Paragraph } = Typography;
|
||||
|
|
@ -33,6 +33,9 @@ export default function PluginHubPage() {
|
|||
|
||||
const [search, setSearch] = useState('');
|
||||
const [importOpen, setImportOpen] = useState(false);
|
||||
const [importInitialEntry, setImportInitialEntry] = useState(null);
|
||||
const [addCatalogOpen, setAddCatalogOpen] = useState(false);
|
||||
const [restoringCatalog, setRestoringCatalog] = useState(false);
|
||||
const [probesOpen, setProbesOpen] = useState(false);
|
||||
const [planState, setPlanState] = useState(null);
|
||||
const [planningCatalogId, setPlanningCatalogId] = useState('');
|
||||
|
|
@ -47,6 +50,7 @@ export default function PluginHubPage() {
|
|||
|
||||
const installs = Array.isArray(installsRes.data?.items) ? installsRes.data.items : [];
|
||||
const catalogItems = Array.isArray(catalogRes.data?.items) ? catalogRes.data.items : [];
|
||||
const hiddenBuiltins = Number(catalogRes.data?.hidden_builtins || 0);
|
||||
const channels = Array.isArray(channelsRes.data?.channels) ? channelsRes.data.channels : [];
|
||||
|
||||
const activeApp = useMemo(
|
||||
|
|
@ -107,6 +111,7 @@ export default function PluginHubPage() {
|
|||
|
||||
const handleCatalogInstall = async entry => {
|
||||
if (entry.availability !== 'plan_available') {
|
||||
setImportInitialEntry({ repository: entry.repository, revision: entry.revision || '' });
|
||||
setImportOpen(true);
|
||||
return;
|
||||
}
|
||||
|
|
@ -125,6 +130,42 @@ export default function PluginHubPage() {
|
|||
}
|
||||
};
|
||||
|
||||
const confirmDeleteCatalog = entry => {
|
||||
confirmAction({
|
||||
title: t('pluginHub.confirmDeleteCatalogTitle', { name: entry.title || entry.id }, `从能力市场移除「${entry.title || entry.id}」?`),
|
||||
content: (
|
||||
<Text type="tertiary">
|
||||
{entry.builtin
|
||||
? t('pluginHub.confirmHideBuiltinDesc', null, '该条目为内置精选目录项,移除后将在市场中隐藏,可随时通过「恢复默认精选」找回;不会影响已安装的实例。')
|
||||
: t('pluginHub.confirmDeleteCustomDesc', null, '将从能力市场永久删除该自定义条目,不会影响已安装的插件实例。')}
|
||||
</Text>
|
||||
),
|
||||
okText: t('common.delete', null, '删除'),
|
||||
onOk: async () => {
|
||||
try {
|
||||
await pluginApi.deleteCatalog(entry.id);
|
||||
toastSuccess(t('pluginHub.catalogDeleted', null, '已从能力市场移除'));
|
||||
catalogRes.reload({ silent: true });
|
||||
} catch (err) {
|
||||
toastError(pluginErrorText(t, err, t('pluginHub.catalogDeleteFailed', null, '删除市场条目失败')));
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const handleRestoreBuiltins = async () => {
|
||||
setRestoringCatalog(true);
|
||||
try {
|
||||
await pluginApi.restoreCatalog();
|
||||
toastSuccess(t('pluginHub.catalogRestored', null, '已恢复全部默认精选目录'));
|
||||
catalogRes.reload({ silent: true });
|
||||
} catch (err) {
|
||||
toastError(pluginErrorText(t, err, t('pluginHub.catalogRestoreFailed', null, '恢复默认精选失败')));
|
||||
} finally {
|
||||
setRestoringCatalog(false);
|
||||
}
|
||||
};
|
||||
|
||||
const runOperation = async (install, kind, extra = {}) => {
|
||||
setBusyInstallId(install.id);
|
||||
try {
|
||||
|
|
@ -404,8 +445,29 @@ export default function PluginHubPage() {
|
|||
</TabPane>
|
||||
|
||||
<TabPane tab={`${t('pluginHub.marketTitle', null, '能力市场')} (${catalogItems.length})`} itemKey="market">
|
||||
{canManage && (
|
||||
<Space style={{ justifyContent: 'space-between', width: '100%', marginTop: 12 }} wrap>
|
||||
<Text type="tertiary" size="small">
|
||||
{t('pluginHub.marketManageHint', null, '支持自由新增开源仓库或删除/隐藏条目;已安装的插件不受市场目录变更影响。')}
|
||||
</Text>
|
||||
<Space wrap>
|
||||
{hiddenBuiltins > 0 && (
|
||||
<Button size="small" icon={<IconRefresh />} loading={restoringCatalog} onClick={handleRestoreBuiltins}>
|
||||
{t('pluginHub.restoreBuiltins', { count: hiddenBuiltins }, `恢复默认精选 (${hiddenBuiltins})`)}
|
||||
</Button>
|
||||
)}
|
||||
<Button size="small" theme="solid" type="primary" icon={<IconPlus />} onClick={() => setAddCatalogOpen(true)}>
|
||||
{t('pluginHub.addCatalogBtn', null, '新增市场插件')}
|
||||
</Button>
|
||||
</Space>
|
||||
</Space>
|
||||
)}
|
||||
<div className="cs-ph-catalog-grid" style={{ marginTop: 14 }}>
|
||||
{filteredCatalog.map(entry => {
|
||||
{filteredCatalog.length === 0 ? (
|
||||
<Text type="tertiary" style={{ padding: '16px 0' }}>
|
||||
{t('pluginHub.emptyMarket', null, '当前能力市场暂无匹配条目,可点击「新增市场插件」添加。')}
|
||||
</Text>
|
||||
) : filteredCatalog.map(entry => {
|
||||
const existing = installs.find(i => i.plugin_id === entry.id);
|
||||
const oneClick = entry.availability === 'plan_available';
|
||||
return (
|
||||
|
|
@ -413,7 +475,12 @@ export default function PluginHubPage() {
|
|||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
||||
<div className="cs-ph-card-head">
|
||||
<div>
|
||||
<Text strong size="normal">{entry.title}</Text>
|
||||
<Space spacing={6}>
|
||||
<Text strong size="normal">{entry.title}</Text>
|
||||
{!entry.builtin && (
|
||||
<Tag size="small" color="violet">{t('pluginHub.catalogCustomBadge', null, '自定义')}</Tag>
|
||||
)}
|
||||
</Space>
|
||||
<div>
|
||||
<Text type="tertiary" size="small" className="cs-ph-mono">{entry.id}</Text>
|
||||
</div>
|
||||
|
|
@ -425,7 +492,7 @@ export default function PluginHubPage() {
|
|||
</Tag>
|
||||
</div>
|
||||
<Paragraph type="tertiary" size="small" style={{ margin: 0 }}>
|
||||
{entry.summary}
|
||||
{entry.summary || t('pluginHub.noSummary', null, '暂无简介')}
|
||||
</Paragraph>
|
||||
<div className="cs-ph-card-meta">
|
||||
<a href={entry.repository} target="_blank" rel="noreferrer" style={{ fontSize: 12 }}>
|
||||
|
|
@ -442,6 +509,17 @@ export default function PluginHubPage() {
|
|||
<Text type="tertiary" size="small">{t('pluginHub.externalRepoHint', null, '代码保留在原作者仓库')}</Text>
|
||||
)}
|
||||
<Space spacing={6}>
|
||||
{canManage && (
|
||||
<Tooltip content={entry.builtin ? t('pluginHub.hideBuiltinTooltip', null, '从市场隐藏') : t('common.delete', null, '删除')}>
|
||||
<Button
|
||||
size="small"
|
||||
theme="borderless"
|
||||
type="danger"
|
||||
icon={<IconDelete />}
|
||||
onClick={() => confirmDeleteCatalog(entry)}
|
||||
/>
|
||||
</Tooltip>
|
||||
)}
|
||||
{existing && canUse && existing.observed_state === 'healthy' && (
|
||||
<Button size="small" theme="solid" type="primary" onClick={() => openApp(existing)}>
|
||||
{t('pluginHub.openWorkspace', null, '打开应用')}
|
||||
|
|
@ -471,11 +549,26 @@ export default function PluginHubPage() {
|
|||
</Tabs>
|
||||
</SectionCard>
|
||||
|
||||
<AddCatalogDrawer
|
||||
visible={addCatalogOpen}
|
||||
onCancel={() => setAddCatalogOpen(false)}
|
||||
onSaved={() => {
|
||||
setAddCatalogOpen(false);
|
||||
catalogRes.reload({ silent: true });
|
||||
}}
|
||||
/>
|
||||
|
||||
<ImportGitDrawer
|
||||
visible={importOpen}
|
||||
onCancel={() => setImportOpen(false)}
|
||||
initialEntry={importInitialEntry}
|
||||
onCancel={() => {
|
||||
setImportOpen(false);
|
||||
setImportInitialEntry(null);
|
||||
}}
|
||||
onCatalogSaved={() => catalogRes.reload({ silent: true })}
|
||||
onPlanReady={res => {
|
||||
setImportOpen(false);
|
||||
setImportInitialEntry(null);
|
||||
setPlanState(res);
|
||||
}}
|
||||
/>
|
||||
|
|
|
|||
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,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-CKro0ye9.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-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};
|
||||
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{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-CKro0ye9.js";import"./c2-shared-CYdOx-YS.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-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};
|
||||
|
|
@ -1 +1 @@
|
|||
import{I as e,L as t}from"./index-CKro0ye9.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-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};
|
||||
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-CKro0ye9.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-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};
|
||||
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-CKro0ye9.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-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};
|
||||
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-CKro0ye9.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-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,`
|
||||
`).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-CKro0ye9.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-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};
|
||||
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-CKro0ye9.js"></script>
|
||||
<script type="module" crossorigin src="/static/app/assets/index-B3TlLo8G.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">
|
||||
|
|
|
|||
|
|
@ -4861,7 +4861,7 @@
|
|||
"importGit": "استيراد مستودع Git",
|
||||
"statInstalled": "الإضافات المثبتة",
|
||||
"statRunning": "التطبيقات العاملة",
|
||||
"statCatalog": "الدليل المعتمد",
|
||||
"statCatalog": "دليل سوق القدرات",
|
||||
"statDrivers": "المشغلات المتاحة",
|
||||
"latestOperation": "آخر عملية",
|
||||
"viewLogs": "عرض السجلات",
|
||||
|
|
@ -5005,6 +5005,34 @@
|
|||
"errorLLMGatewayUnavailable": "بوابة نماذج الإضافات غير متاحة",
|
||||
"errorWebUnavailable": "وكيل الواجهة غير متاح أو الإضافة غير جاهزة",
|
||||
"errorEmbedRejected": "تم رفض الصلاحية أو مصدر الطلب لمساحة عمل الإضافة",
|
||||
"errorNotFound": "لم يتم العثور على سجل الإضافة أو الخطة"
|
||||
"errorNotFound": "لم يتم العثور على سجل الإضافة أو الخطة",
|
||||
"errorInvalidRequest": "معاملات الطلب غير صالحة؛ تحقق من معرّف الإضافة (أحرف صغيرة وأرقام وشرطات) والعنوان ورابط المستودع",
|
||||
"addCatalogBtn": "إضافة إضافة للسوق",
|
||||
"addCatalogTitle": "إضافة إلى سوق القدرات",
|
||||
"addCatalogDesc": "أضف مستودع GitHub عامًا إلى سوق القدرات المحلي. ترك البيان فارغًا يفعّل وضع الفحص والاستيراد، وتقديم بيان YAML/JSON صالح يفعّل التثبيت بنقرة واحدة.",
|
||||
"saveToMarket": "حفظ في السوق",
|
||||
"probeAndFill": "فحص وتعبئة تلقائية",
|
||||
"catalogProbeWithManifest": "تم اكتشاف بيان المستودع؛ سيتوفر التثبيت بنقرة واحدة بعد الحفظ",
|
||||
"catalogProbeSuccess": "اكتمل الفحص للقراءة فقط وتمت تعبئة البيانات الأساسية",
|
||||
"catalogRepoRequired": "يرجى إدخال رابط مستودع GitHub أو تقديم بيان Manifest",
|
||||
"catalogSaved": "تم الحفظ في سوق القدرات",
|
||||
"catalogSaveFailed": "فشل الحفظ في سوق القدرات",
|
||||
"catalogSummaryLabel": "الوصف",
|
||||
"catalogSummaryPlaceholder": "وصف مختصر لوظيفة الأداة الأمنية أو بنيتها",
|
||||
"catalogManifestOptional": "بيان الإضافة Manifest (اختياري، YAML أو JSON)",
|
||||
"catalogManifestPlaceholder": "اختياري: الصق csai-plugin.yaml أو JSON، أو اضغط فحص وتعبئة تلقائية أعلاه لجلبه من المستودع",
|
||||
"marketManageHint": "يمكنك إضافة مستودعات مخصصة أو حذف/إخفاء العناصر بحرية دون التأثير على الإضافات المثبتة.",
|
||||
"restoreBuiltins": "استعادة الافتراضي ({count})",
|
||||
"emptyMarket": "لا توجد عناصر مطابقة في السوق حاليًا. اضغط إضافة إضافة للسوق لإضافة عنصر جديد.",
|
||||
"catalogCustomBadge": "مخصص",
|
||||
"noSummary": "لا يوجد وصف",
|
||||
"hideBuiltinTooltip": "إخفاء من السوق",
|
||||
"confirmDeleteCatalogTitle": "إزالة «{name}» من سوق القدرات؟",
|
||||
"confirmHideBuiltinDesc": "هذا عنصر مدمج؛ إزالته تخفيه من السوق ويمكن استعادته لاحقًا عبر استعادة الافتراضي دون التأثير على النسخ المثبتة.",
|
||||
"confirmDeleteCustomDesc": "سيتم حذف هذا العنصر المخصص نهائيًا من السوق دون التأثير على الإضافات المثبتة.",
|
||||
"catalogDeleted": "تمت الإزالة من سوق القدرات",
|
||||
"catalogDeleteFailed": "فشل حذف عنصر السوق",
|
||||
"catalogRestored": "تمت استعادة جميع العناصر الافتراضية",
|
||||
"catalogRestoreFailed": "فشلت استعادة العناصر الافتراضية"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5996,7 +5996,7 @@
|
|||
"importGit": "Import Git Repo",
|
||||
"statInstalled": "Installed Plugins",
|
||||
"statRunning": "Running Apps",
|
||||
"statCatalog": "Curated Catalog",
|
||||
"statCatalog": "Market Catalog",
|
||||
"statDrivers": "Available Drivers",
|
||||
"latestOperation": "Latest Operation",
|
||||
"viewLogs": "View Logs",
|
||||
|
|
@ -6140,6 +6140,34 @@
|
|||
"errorLLMGatewayUnavailable": "CSAI plugin LLM gateway is unavailable",
|
||||
"errorWebUnavailable": "Plugin WebUI proxy is unavailable or app is not healthy",
|
||||
"errorEmbedRejected": "Permission denied or invalid origin for plugin workspace",
|
||||
"errorNotFound": "Plugin record or plan not found"
|
||||
"errorNotFound": "Plugin record or plan not found",
|
||||
"errorInvalidRequest": "Invalid request parameters. Check plugin ID (lowercase letters, digits, hyphens), title, and repository URL",
|
||||
"addCatalogBtn": "Add Market Plugin",
|
||||
"addCatalogTitle": "Add Plugin to Market",
|
||||
"addCatalogDesc": "Register a public GitHub repository into the local Capability Market. Leave Manifest blank for inspect-and-import mode, or provide a valid YAML/JSON Manifest to enable one-click install.",
|
||||
"saveToMarket": "Save to Market",
|
||||
"probeAndFill": "Probe & Auto-Fill",
|
||||
"catalogProbeWithManifest": "Detected repository Manifest; one-click install will be enabled after saving",
|
||||
"catalogProbeSuccess": "Read-only repository probe completed; basic fields auto-filled",
|
||||
"catalogRepoRequired": "Enter a GitHub repository URL or provide a Manifest",
|
||||
"catalogSaved": "Saved to Capability Market",
|
||||
"catalogSaveFailed": "Failed to save to Capability Market",
|
||||
"catalogSummaryLabel": "Summary",
|
||||
"catalogSummaryPlaceholder": "Briefly describe the security tool's purpose or architecture",
|
||||
"catalogManifestOptional": "Plugin Manifest (optional, YAML or JSON)",
|
||||
"catalogManifestPlaceholder": "Optional: paste csai-plugin.yaml or JSON declaration; click Probe & Auto-Fill above to read csai-plugin.yaml from the repo root",
|
||||
"marketManageHint": "Add custom open-source repositories or delete/hide market entries freely; installed plugins are not affected.",
|
||||
"restoreBuiltins": "Restore Defaults ({count})",
|
||||
"emptyMarket": "No matching plugins in the market. Click Add Market Plugin to register one.",
|
||||
"catalogCustomBadge": "Custom",
|
||||
"noSummary": "No summary",
|
||||
"hideBuiltinTooltip": "Hide from market",
|
||||
"confirmDeleteCatalogTitle": "Remove \"{name}\" from Capability Market?",
|
||||
"confirmHideBuiltinDesc": "This is a built-in curated entry. Removing it hides it from the market and you can restore it anytime via Restore Defaults; installed instances are unaffected.",
|
||||
"confirmDeleteCustomDesc": "This will permanently remove the custom entry from the market without affecting installed plugin instances.",
|
||||
"catalogDeleted": "Removed from Capability Market",
|
||||
"catalogDeleteFailed": "Failed to remove market entry",
|
||||
"catalogRestored": "Restored all default curated entries",
|
||||
"catalogRestoreFailed": "Failed to restore default entries"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5896,7 +5896,7 @@
|
|||
"importGit": "Импорт из Git",
|
||||
"statInstalled": "Установлено",
|
||||
"statRunning": "Запущено",
|
||||
"statCatalog": "Каталог",
|
||||
"statCatalog": "Каталог маркета",
|
||||
"statDrivers": "Драйверы",
|
||||
"latestOperation": "Последняя операция",
|
||||
"viewLogs": "Логи",
|
||||
|
|
@ -6040,6 +6040,34 @@
|
|||
"errorLLMGatewayUnavailable": "LLM-шлюз плагинов недоступен",
|
||||
"errorWebUnavailable": "WebUI-прокси недоступен или плагин не запущен",
|
||||
"errorEmbedRejected": "Нет прав доступа или отклонен Origin",
|
||||
"errorNotFound": "Запись плагина или план не найдены"
|
||||
"errorNotFound": "Запись плагина или план не найдены",
|
||||
"errorInvalidRequest": "Некорректные параметры запроса: проверьте ID плагина (строчные буквы, цифры и дефисы), название и URL репозитория",
|
||||
"addCatalogBtn": "Добавить в маркет",
|
||||
"addCatalogTitle": "Добавить плагин в маркет",
|
||||
"addCatalogDesc": "Добавьте публичный репозиторий GitHub в локальный маркет. Без манифеста карточка будет доступна для анализа и импорта; с валидным YAML/JSON манифестом — для установки в один клик.",
|
||||
"saveToMarket": "Сохранить в маркет",
|
||||
"probeAndFill": "Проверить и заполнить",
|
||||
"catalogProbeWithManifest": "Найден манифест репозитория — после сохранения будет доступна установка в один клик",
|
||||
"catalogProbeSuccess": "Проверка репозитория завершена, основные поля заполнены",
|
||||
"catalogRepoRequired": "Укажите URL репозитория GitHub или вставьте манифест",
|
||||
"catalogSaved": "Сохранено в маркет возможностей",
|
||||
"catalogSaveFailed": "Не удалось сохранить в маркет",
|
||||
"catalogSummaryLabel": "Описание",
|
||||
"catalogSummaryPlaceholder": "Кратко опишите назначение и архитектуру инструмента",
|
||||
"catalogManifestOptional": "Манифест плагина (необязательно, YAML или JSON)",
|
||||
"catalogManifestPlaceholder": "Необязательно: вставьте csai-plugin.yaml или JSON; кнопка выше загрузит манифест из корня репозитория",
|
||||
"marketManageHint": "Вы можете добавлять свои репозитории и удалять или скрывать карточки; установленные плагины не затрагиваются.",
|
||||
"restoreBuiltins": "Восстановить встроенные ({count})",
|
||||
"emptyMarket": "Подходящих записей в маркете нет. Нажмите «Добавить в маркет», чтобы создать карточку.",
|
||||
"catalogCustomBadge": "Свой",
|
||||
"noSummary": "Нет описания",
|
||||
"hideBuiltinTooltip": "Скрыть из маркета",
|
||||
"confirmDeleteCatalogTitle": "Удалить «{name}» из маркета?",
|
||||
"confirmHideBuiltinDesc": "Встроенная запись будет скрыта из маркета и сможет быть восстановлена в любой момент. Установленные экземпляры не затронуты.",
|
||||
"confirmDeleteCustomDesc": "Пользовательская запись будет удалена из маркета навсегда без влияния на установленные плагины.",
|
||||
"catalogDeleted": "Удалено из маркета",
|
||||
"catalogDeleteFailed": "Не удалось удалить запись маркета",
|
||||
"catalogRestored": "Все встроенные записи восстановлены",
|
||||
"catalogRestoreFailed": "Не удалось восстановить встроенные записи"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5892,7 +5892,7 @@
|
|||
"importGit": "手工导入 Git 仓库",
|
||||
"statInstalled": "已安装插件",
|
||||
"statRunning": "运行中应用",
|
||||
"statCatalog": "官方精选目录",
|
||||
"statCatalog": "能力市场目录",
|
||||
"statDrivers": "宿主可用驱动",
|
||||
"latestOperation": "最近任务",
|
||||
"viewLogs": "查看日志",
|
||||
|
|
@ -6036,6 +6036,34 @@
|
|||
"errorLLMGatewayUnavailable": "CSAI 插件模型网关未就绪",
|
||||
"errorWebUnavailable": "插件 WebUI 代理未就绪或应用尚未健康启动",
|
||||
"errorEmbedRejected": "无权访问该插件工作区或请求来源校验未通过",
|
||||
"errorNotFound": "未找到对应的插件记录或计划已过期"
|
||||
"errorNotFound": "未找到对应的插件记录或计划已过期",
|
||||
"errorInvalidRequest": "请求参数不合法,请检查插件 ID(仅限小写字母、数字和连字符)、标题与仓库地址",
|
||||
"addCatalogBtn": "新增市场插件",
|
||||
"addCatalogTitle": "新增能力市场插件",
|
||||
"addCatalogDesc": "将公开 GitHub 仓库收录到本机能力市场。留空 Manifest 将以「支持探测导入」模式展示;提供合法 YAML/JSON Manifest 后将直接支持「一键下载安装」。",
|
||||
"saveToMarket": "保存到能力市场",
|
||||
"probeAndFill": "探测并自动填充",
|
||||
"catalogProbeWithManifest": "已探测到仓库自带 Manifest,保存后支持一键安装",
|
||||
"catalogProbeSuccess": "仓库只读探测完成,已自动填充基础信息",
|
||||
"catalogRepoRequired": "请填写 GitHub 仓库地址或提供 Manifest",
|
||||
"catalogSaved": "已保存到能力市场",
|
||||
"catalogSaveFailed": "保存到能力市场失败",
|
||||
"catalogSummaryLabel": "功能简介",
|
||||
"catalogSummaryPlaceholder": "简述该开源安全工具的用途、架构或特性",
|
||||
"catalogManifestOptional": "插件 Manifest(可选,支持 YAML 或 JSON)",
|
||||
"catalogManifestPlaceholder": "可选:粘贴 csai-plugin.yaml 或 JSON 声明;点击上方「探测并自动填充」可自动抓取仓库根目录的 csai-plugin.yaml",
|
||||
"marketManageHint": "支持自由新增开源仓库或删除/隐藏条目;已安装的插件不受市场目录变更影响。",
|
||||
"restoreBuiltins": "恢复默认精选 ({count})",
|
||||
"emptyMarket": "当前能力市场暂无匹配条目,可点击「新增市场插件」添加。",
|
||||
"catalogCustomBadge": "自定义",
|
||||
"noSummary": "暂无简介",
|
||||
"hideBuiltinTooltip": "从市场隐藏",
|
||||
"confirmDeleteCatalogTitle": "从能力市场移除「{name}」?",
|
||||
"confirmHideBuiltinDesc": "该条目为内置精选目录项,移除后将在市场中隐藏,可随时通过「恢复默认精选」找回;不会影响已安装的实例。",
|
||||
"confirmDeleteCustomDesc": "将从能力市场永久删除该自定义条目,不会影响已安装的插件实例。",
|
||||
"catalogDeleted": "已从能力市场移除",
|
||||
"catalogDeleteFailed": "删除市场条目失败",
|
||||
"catalogRestored": "已恢复全部默认精选目录",
|
||||
"catalogRestoreFailed": "恢复默认精选失败"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue