mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-20 20:34:19 +00:00
fix(plugins): open managed plugins from their snapshot and explain slow reads
Opening a plugin cloned its whole source again to learn which Agents can take it, which took tens of seconds per row. A managed plugin already has a reviewed snapshot; it answers when its digest still matches, and the network is used only otherwise. A failed clone said only that git failed. Git's output is sorted into an unreachable source or a missing one without passing it on, since it can hold credentials. The dashboard translates those, notes when a read or an Agent's CLI is slow, and says when the browser is offline.
This commit is contained in:
@@ -86,6 +86,19 @@ func (s *Service) Discover(ctx context.Context, source, ref, entry string) (*Dis
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return s.withAccounts(d), nil
|
||||
}
|
||||
|
||||
// DiscoverManaged is Discover for the package name already manages. Its reviewed snapshot
|
||||
// answers when it is of the same source, so opening the plugin does not clone it again.
|
||||
func (s *Service) DiscoverManaged(ctx context.Context, name, source, ref, entry string) (*Discovery, error) {
|
||||
if d := s.discoverSnapshot(name, source, ref, entry); d != nil {
|
||||
return s.withAccounts(d), nil
|
||||
}
|
||||
return s.Discover(ctx, source, ref, entry)
|
||||
}
|
||||
|
||||
func (s *Service) withAccounts(d *Discovery) *Discovery {
|
||||
d.TargetDefinitions = s.TargetDefinitions()
|
||||
for i := range d.Candidates {
|
||||
c := &d.Candidates[i]
|
||||
@@ -101,5 +114,5 @@ func (s *Service) Discover(ctx context.Context, source, ref, entry string) (*Dis
|
||||
}
|
||||
slices.Sort(c.Targets)
|
||||
}
|
||||
return d, nil
|
||||
return d
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// maxPreview keeps a stray bundle or binary from being sent to the browser whole.
|
||||
@@ -38,6 +39,32 @@ func (s *Service) snapshotDir(name string) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// discoverSnapshot reads a remote source from the snapshot of a binding made from it, nil
|
||||
// when there is none. A snapshot whose digest no longer matches was edited, so it does not answer.
|
||||
func (s *Service) discoverSnapshot(name, source, ref, entry string) *Discovery {
|
||||
if name == "" || !strings.HasPrefix(source, "https://") {
|
||||
return nil
|
||||
}
|
||||
d, err := s.load()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
pack := d.packages[name]
|
||||
for _, target := range slices.Sorted(maps.Keys(pack.Bindings)) {
|
||||
b := pack.Bindings[target]
|
||||
if b.Source != source || b.SourceRef != ref || b.Digest == "" {
|
||||
continue
|
||||
}
|
||||
found, err := discoverRoot(filepath.Join(s.snapshotPath(b, target), "content"), b.Source, entry)
|
||||
if err != nil || found.Digest != b.Digest {
|
||||
continue
|
||||
}
|
||||
found.SourceRef, found.Commit = b.SourceRef, b.Commit
|
||||
return found
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files lists the snapshot, slash separated and sorted. Nothing is read from the network.
|
||||
func (s *Service) Files(name string) ([]string, error) {
|
||||
dir, err := s.snapshotDir(name)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package plugin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
@@ -57,3 +58,28 @@ func TestSaveKeepsTwoSpaceIndent(t *testing.T) {
|
||||
t.Errorf("got:\n%s\nwant prefix:\n%s", data, want)
|
||||
}
|
||||
}
|
||||
|
||||
// Opening a managed plugin asks which other Agents can take it. Its reviewed snapshot answers,
|
||||
// so nothing is cloned: with no git on PATH, a clone would fail.
|
||||
func TestDiscoverManagedReadsTheSnapshotWithoutGit(t *testing.T) {
|
||||
var calls []string
|
||||
s := accountPluginService(t, &calls)
|
||||
source := "https://example.invalid/demo.git"
|
||||
digest, err := treeDigest(fixture(t))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
b := Binding{ID: "demo@skillshare-abc", Source: source, Plugin: "demo", Digest: digest, Commit: "abc123"}
|
||||
if err := copyTree(fixture(t), filepath.Join(s.snapshotPath(b, "claude"), "content")); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
writePluginFile(t, filepath.Dir(s.ConfigPath), "config.yaml", "plugins:\n packages:\n demo:\n bindings:\n claude:\n id: demo@skillshare-abc\n source: "+source+"\n plugin: demo\n commit: abc123\n digest: "+digest+"\n")
|
||||
t.Setenv("PATH", t.TempDir())
|
||||
d, err := s.DiscoverManaged(context.Background(), "demo", source, "", "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if d.Source != source || d.Commit != "abc123" || d.Digest != digest || len(d.Candidates) != 1 || !slices.Contains(d.Candidates[0].Targets, "claude-work") || len(calls) != 0 {
|
||||
t.Fatalf("discovery = %+v, calls = %v", d, calls)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,23 @@ func TestRunCommandMarksAnAbsentBinary(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGitFailureNamesTheCauseWithoutItsOutput(t *testing.T) {
|
||||
for stderr, key := range map[string]string{
|
||||
"fatal: unable to access 'https://x/': Could not resolve host: github.com": "plugins.error.network",
|
||||
"fatal: unable to access 'https://x/': Failed to connect to github.com port 443": "plugins.error.network",
|
||||
"remote: Repository not found.\nfatal: repository 'https://x/' not found": "plugins.error.sourceNotFound",
|
||||
"fatal: couldn't find remote ref nope": "plugins.error.sourceNotFound",
|
||||
} {
|
||||
failure, ok := gitFailure(stderr)
|
||||
if !ok || failure.key != key || strings.Contains(failure.message, "https://x/") {
|
||||
t.Errorf("%q: key = %q, message = %q, want %s", stderr, failure.key, failure.message, key)
|
||||
}
|
||||
}
|
||||
if _, ok := gitFailure("fatal: something else"); ok {
|
||||
t.Error("an unknown failure was classified")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunCommandReadsVersionFromStderr(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
if err := os.WriteFile(filepath.Join(dir, "pi"), []byte("#!/bin/sh\necho 0.73.1 >&2\n"), 0755); err != nil {
|
||||
|
||||
@@ -34,6 +34,36 @@ type agentError struct {
|
||||
func (e agentError) Error() string { return e.message }
|
||||
func (e agentError) Unwrap() error { return e.cause }
|
||||
|
||||
// ErrorKey is the translation key and arguments of a fixed failure, "" when the message
|
||||
// was assembled at runtime.
|
||||
func ErrorKey(err error) (string, map[string]string) {
|
||||
var keyed agentError
|
||||
if errors.As(err, &keyed) {
|
||||
return keyed.key, keyed.args
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// gitFailure sorts a git failure by the words in its stderr, so the dashboard can say
|
||||
// whether the network or the source is at fault. Only the key leaves this function:
|
||||
// stderr can echo a URL with credentials. LC_ALL=C keeps the words English.
|
||||
func gitFailure(stderr string) (agentError, bool) {
|
||||
lower := strings.ToLower(stderr)
|
||||
// A missing repository is checked first: git reports it as "unable to access" too, and
|
||||
// GitHub asks for a username when the repository does not exist or is private.
|
||||
for _, s := range []string{"repository not found", "does not appear to be a git repository", "couldn't find remote ref", "returned error: 404", "not found", "could not read username"} {
|
||||
if strings.Contains(lower, s) {
|
||||
return agentError{key: "plugins.error.sourceNotFound", message: "plugin source not found; check the repository address and branch"}, true
|
||||
}
|
||||
}
|
||||
for _, s := range []string{"could not resolve host", "failed to connect", "connection timed out", "connection refused", "unable to access", "operation timed out", "network is unreachable"} {
|
||||
if strings.Contains(lower, s) {
|
||||
return agentError{key: "plugins.error.network", message: "could not reach the plugin source; check the network connection and try again"}, true
|
||||
}
|
||||
}
|
||||
return agentError{}, false
|
||||
}
|
||||
|
||||
func runCommand(ctx context.Context, dir string, env []string, bin string, args ...string) ([]byte, error) {
|
||||
ctx, cancel := context.WithTimeout(ctx, 90*time.Second)
|
||||
defer cancel()
|
||||
@@ -41,6 +71,9 @@ func runCommand(ctx context.Context, dir string, env []string, bin string, args
|
||||
cmd.Dir = dir
|
||||
// No shell, inherited stdin, or automatic native trust/command confirmation.
|
||||
cmd.Env = append(append(os.Environ(), "GIT_TERMINAL_PROMPT=0"), env...)
|
||||
if bin == "git" {
|
||||
cmd.Env = append(cmd.Env, "LC_ALL=C")
|
||||
}
|
||||
var stdout, stderr bytes.Buffer
|
||||
cmd.Stdout = &stdout
|
||||
cmd.Stderr = &stderr
|
||||
@@ -51,6 +84,11 @@ func runCommand(ctx context.Context, dir string, env []string, bin string, args
|
||||
if ctx.Err() != nil {
|
||||
return nil, agentError{key: "plugins.error.timeout", message: fmt.Sprintf("%s timed out or was cancelled; inspect native status before retrying", bin)}
|
||||
}
|
||||
if bin == "git" {
|
||||
if failure, ok := gitFailure(stderr.String()); ok {
|
||||
return nil, failure
|
||||
}
|
||||
}
|
||||
// Native output can contain credentials or command-source scripts.
|
||||
return nil, agentError{key: "plugins.error.commandFailed", message: fmt.Sprintf("%s command failed; open the native client to resolve authentication, trust, or configuration", bin)}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,9 @@ func (s *Server) handlePluginList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (s *Server) handlePluginDiscover(w http.ResponseWriter, r *http.Request) {
|
||||
// Name is set for a plugin already managed here, whose snapshot can answer instead of the network.
|
||||
var body struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Source string `json:"source"`
|
||||
SourceRef string `json:"sourceRef,omitempty"`
|
||||
Entry string `json:"entry,omitempty"`
|
||||
@@ -91,8 +93,13 @@ func (s *Server) handlePluginDiscover(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
result, err := s.pluginService().Discover(r.Context(), body.Source, body.SourceRef, body.Entry)
|
||||
result, err := s.pluginService().DiscoverManaged(r.Context(), body.Name, body.Source, body.SourceRef, body.Entry)
|
||||
if err != nil {
|
||||
// A fixed failure carries its key as the error code, so the dashboard can translate it.
|
||||
if key, args := plugin.ErrorKey(err); key != "" {
|
||||
writeCodedError(w, 400, key, err.Error(), args)
|
||||
return
|
||||
}
|
||||
writeError(w, 400, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,3 +53,16 @@ func TestPluginListIncludesAnAccountOfAnAgent(t *testing.T) {
|
||||
t.Fatalf("the account is missing: %+v", inventory.TargetDefinitions)
|
||||
}
|
||||
}
|
||||
|
||||
// A source that cannot be reached answers with a key the dashboard translates, not git's output.
|
||||
func TestPluginDiscoverNamesANetworkFailure(t *testing.T) {
|
||||
s, _ := newTestServerWithExtras(t, nil, "")
|
||||
w := httptest.NewRecorder()
|
||||
s.handlePluginDiscover(w, httptest.NewRequest(http.MethodPost, "/api/plugins/discover", strings.NewReader(`{"name":"demo","source":"https://127.0.0.1:1/demo.git"}`)))
|
||||
var body struct {
|
||||
Code string `json:"error_code"`
|
||||
}
|
||||
if err := json.Unmarshal(w.Body.Bytes(), &body); err != nil || w.Code != 400 || body.Code != "plugins.error.network" {
|
||||
t.Fatalf("status %d: %s", w.Code, w.Body.String())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,8 @@ export const pluginsApi = {
|
||||
// A failed inventory could arrive as null; one Agent must not break the whole page.
|
||||
hosts: inv.hosts.map((h) => ({ ...h, installed: (h.installed as NativePlugin[] | null) ?? [] })),
|
||||
})),
|
||||
discover: (source: string, sourceRef?: string, entry?: string) => post<PluginDiscovery>('/plugins/discover', { source, sourceRef, entry }),
|
||||
/** `name` is a plugin already managed here: its reviewed copy answers instead of downloading the source again. */
|
||||
discover: (source: string, sourceRef?: string, entry?: string, name?: string) => post<PluginDiscovery>('/plugins/discover', { source, sourceRef, entry, name }),
|
||||
/** The reviewed local copy of the plugin's source; empty for an imported plugin, which has none. */
|
||||
files: (name: string) => apiFetch<{ files: string[] }>(`/plugins/${encodeURIComponent(name)}/files`),
|
||||
file: (name: string, path: string) => apiFetch<{ content: string }>(`/plugins/${encodeURIComponent(name)}/files/${path.split('/').map(encodeURIComponent).join('/')}`),
|
||||
|
||||
@@ -3,6 +3,8 @@ import { pluginsApi, targetMap, type PluginBinding, type PluginDiscovery, type P
|
||||
import { Check, ChevronDown, ChevronRight, Search, X } from 'lucide-react';
|
||||
import AgentIcon from '../AgentIcon';
|
||||
import { agentReasons } from './agentReasons';
|
||||
import SourceHint from './SourceHint';
|
||||
import { pluginErrorMessage } from './pluginError';
|
||||
import PluginDocsLink from './PluginDocsLink';
|
||||
import Button from '../Button';
|
||||
import DialogShell from '../DialogShell';
|
||||
@@ -55,7 +57,7 @@ export default function PluginAddDialog({ onClose, onPreview, initialSource = ''
|
||||
// A blocked row cannot be chosen, so it is never chosen for the user either.
|
||||
const open = d.candidates.filter((c) => !c.problem);
|
||||
if (!keep) { setName(open.find((c) => c.name === plugin)?.name ?? (open.length === 1 ? open[0].name : '')); setTargets([]); }
|
||||
} catch (e) { setError((e as Error).message); }
|
||||
} catch (e) { setError(pluginErrorMessage(e, t)); }
|
||||
finally { setBusy(false); }
|
||||
};
|
||||
// Asking for a click on a source that is already filled in would be a step with nothing to decide.
|
||||
@@ -79,7 +81,10 @@ export default function PluginAddDialog({ onClose, onPreview, initialSource = ''
|
||||
</div>
|
||||
<div className="db overflow-y-auto">
|
||||
{!discovery && extending && busy ? (
|
||||
<p className="flex items-center gap-2 text-[13px] text-ink-2"><Spinner size="sm" />{t('plugins.discovering')}</p>
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<p className="flex items-center gap-2 text-[13px] text-ink-2"><Spinner size="sm" />{t('plugins.discovering')}</p>
|
||||
<SourceHint active />
|
||||
</div>
|
||||
) : !discovery ? (
|
||||
<form id="plugin-source" className="flex flex-col gap-3.5" onSubmit={(e) => { e.preventDefault(); if (source.trim()) void discover(); }}>
|
||||
<Input label={t('plugins.source')} placeholder="owner/repo" value={source} disabled={busy} autoFocus onChange={(e) => setSource(e.target.value)} />
|
||||
@@ -88,6 +93,7 @@ export default function PluginAddDialog({ onClose, onPreview, initialSource = ''
|
||||
{t('plugins.advanced')}
|
||||
</button>
|
||||
{advanced && <div className="ml-[22px]"><Input label={t('plugins.sourceRef')} placeholder="main" value={sourceRef} disabled={busy} onChange={(e) => setSourceRef(e.target.value)} /></div>}
|
||||
{(busy || error) && <SourceHint active={busy} />}
|
||||
</form>
|
||||
) : (
|
||||
<>
|
||||
|
||||
@@ -4,6 +4,7 @@ import IconButton from '../IconButton';
|
||||
import { RailGroup, RailRow, RailSection } from '../StatusRail';
|
||||
import PluginDocsLink from './PluginDocsLink';
|
||||
import { useT } from '../../i18n';
|
||||
import { useSlow } from '../../hooks/useSlow';
|
||||
|
||||
interface Props {
|
||||
inventory: PluginInventory;
|
||||
@@ -17,6 +18,8 @@ interface Props {
|
||||
/** Agents grouped by what you would do about them: use it, open it, leave it, or install its CLI. */
|
||||
export default function PluginAgents({ inventory, ready, refreshing, disabled, onRefresh }: Props) {
|
||||
const t = useT();
|
||||
// One Agent's CLI can hang on its own network call; say so instead of spinning in silence.
|
||||
const slow = useSlow(!ready, 10000);
|
||||
const definitions = inventory.targetDefinitions ?? [];
|
||||
const labels = targetMap(definitions);
|
||||
const label = (target: string) => labels[target]?.label ?? target;
|
||||
@@ -33,7 +36,7 @@ export default function PluginAgents({ inventory, ready, refreshing, disabled, o
|
||||
return (
|
||||
<RailSection title={t('layout.nav.agents')} count={definitions.length} action={<IconButton icon={<RefreshCw size={15} className={refreshing ? 'animate-spin' : ''} />} label={t('plugins.refresh')} disabled={disabled || refreshing} onClick={onRefresh} />}>
|
||||
{!ready ? (
|
||||
<RailGroup label={t('plugins.hostsAsking')}>
|
||||
<RailGroup label={t('plugins.hostsAsking')} foot={slow ? t('plugins.hostsSlow') : undefined}>
|
||||
{definitions.map((d) => <RailRow key={d.target} target={d.target} label={d.label} dim right={<span className="ss-skel w-11 shrink-0" />} />)}
|
||||
</RailGroup>
|
||||
) : (
|
||||
|
||||
@@ -5,6 +5,8 @@ import { pluginsApi, syncAction, targetMap, type PluginInventory, type PluginReq
|
||||
import AgentIcon from '../AgentIcon';
|
||||
import Spinner from '../Spinner';
|
||||
import { agentReasons } from './agentReasons';
|
||||
import SourceHint from './SourceHint';
|
||||
import { pluginErrorMessage } from './pluginError';
|
||||
import { useT } from '../../i18n';
|
||||
import { useAppContext } from '../../context/AppContext';
|
||||
import { shortenPath } from '../../lib/paths';
|
||||
@@ -57,7 +59,7 @@ function Row({ name, inventory, updates, busy, working, onToggle, onMenu, onAdd,
|
||||
// ponytail: one discovery per plugin per session; give it a refresh control if sources change under an open dashboard.
|
||||
const found = useQuery({
|
||||
queryKey: ['plugin-discover', source, sourceRef, entry],
|
||||
queryFn: () => pluginsApi.discover(source!, sourceRef, entry),
|
||||
queryFn: () => pluginsApi.discover(source!, sourceRef, entry, name),
|
||||
enabled: expanded && !!source,
|
||||
staleTime: Infinity,
|
||||
retry: false,
|
||||
@@ -127,7 +129,8 @@ function Row({ name, inventory, updates, busy, working, onToggle, onMenu, onAdd,
|
||||
/>
|
||||
))}
|
||||
{found.isFetching && <span className="flex items-center gap-2 text-[13px] text-ink-3"><Spinner size="sm" />{t('plugins.discovering')}</span>}
|
||||
{found.error && <span className="text-xs text-ink-3">{(found.error as Error).message}</span>}
|
||||
{(found.isFetching || found.error) && <SourceHint active={found.isFetching} />}
|
||||
{found.error && <span className="text-xs text-ink-3">{pluginErrorMessage(found.error, t)}</span>}
|
||||
{blocked > 0 && <button type="button" className="ss-more" disabled={busy} onClick={() => onBlocked(name, source)}>{t('plugins.moreBlocked', { count: blocked })}</button>}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { useOnline, useSlow } from '../../hooks/useSlow';
|
||||
import { useT } from '../../i18n';
|
||||
|
||||
/** Why reading a source may be taking long: the machine is offline, or the source is being downloaded. */
|
||||
export default function SourceHint({ active }: { active: boolean }) {
|
||||
const t = useT();
|
||||
const online = useOnline();
|
||||
const slow = useSlow(active, 5000);
|
||||
if (!online) return <span className="text-xs text-warn">{t('plugins.offline')}</span>;
|
||||
return slow ? <span className="text-xs text-ink-3">{t('plugins.sourceSlow')}</span> : null;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { ApiError } from '../../api/client';
|
||||
import type { useT } from '../../i18n';
|
||||
|
||||
/** A plugin failure the backend keyed, such as an unreachable source, in the reader's language; otherwise its message. */
|
||||
export function pluginErrorMessage(error: unknown, t: ReturnType<typeof useT>) {
|
||||
const message = (error as Error).message;
|
||||
if (error instanceof ApiError && error.code?.startsWith('plugins.')) {
|
||||
return t(error.code, error.params as Record<string, string> | undefined, message);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { act, renderHook } from '@testing-library/react';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { useSlow } from '../useSlow';
|
||||
|
||||
describe('useSlow', () => {
|
||||
beforeEach(() => vi.useFakeTimers());
|
||||
afterEach(() => vi.useRealTimers());
|
||||
|
||||
it('turns true only once the wait has lasted, and resets when it ends', () => {
|
||||
const { result, rerender } = renderHook(({ active }) => useSlow(active, 5000), { initialProps: { active: true } });
|
||||
act(() => { vi.advanceTimersByTime(4999); });
|
||||
expect(result.current).toBe(false);
|
||||
act(() => { vi.advanceTimersByTime(1); });
|
||||
expect(result.current).toBe(true);
|
||||
rerender({ active: false });
|
||||
expect(result.current).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
/** True once `active` has lasted `ms`, so a hint appears only for a wait the user would notice. */
|
||||
export function useSlow(active: boolean, ms: number) {
|
||||
const [slow, setSlow] = useState(false);
|
||||
useEffect(() => {
|
||||
if (!active) return;
|
||||
const timer = setTimeout(() => setSlow(true), ms);
|
||||
return () => { clearTimeout(timer); setSlow(false); };
|
||||
}, [active, ms]);
|
||||
return active && slow;
|
||||
}
|
||||
|
||||
/** Whether the browser believes it is online; a source on the network cannot be read otherwise. */
|
||||
export function useOnline() {
|
||||
const [online, setOnline] = useState(() => navigator.onLine);
|
||||
useEffect(() => {
|
||||
const update = () => setOnline(navigator.onLine);
|
||||
window.addEventListener('online', update);
|
||||
window.addEventListener('offline', update);
|
||||
return () => {
|
||||
window.removeEventListener('online', update);
|
||||
window.removeEventListener('offline', update);
|
||||
};
|
||||
}, []);
|
||||
return online;
|
||||
}
|
||||
@@ -1788,6 +1788,8 @@
|
||||
"plugins.sourceHelp": "owner/repo, HTTPS-Git-URL oder lokalen Ordner eingeben. Die Vorschau installiert nichts.",
|
||||
"plugins.discover": "Plugins suchen",
|
||||
"plugins.discovering": "Quelle wird gelesen…",
|
||||
"plugins.sourceSlow": "Die Quelle liegt im Netzwerk, daher kann das erste Lesen einige Zehn Sekunden dauern.",
|
||||
"plugins.offline": "Du bist offline. Plugin-Quellen im Netzwerk können gelesen werden, sobald die Verbindung wieder steht.",
|
||||
"plugins.choose": "Plugin wählen",
|
||||
"plugins.targets": "Synchronisieren mit",
|
||||
"plugins.addAgents": "Zu weiteren Agents hinzufügen",
|
||||
@@ -1823,6 +1825,7 @@
|
||||
"plugins.syncHint": "Die Änderungen werden zuerst zur Prüfung angezeigt. Vor der Bestätigung wird nichts installiert oder entfernt.",
|
||||
"plugins.syncAgain": "Erneut synchronisieren",
|
||||
"plugins.hostsAsking": "CLI jedes Agents wird abgefragt…",
|
||||
"plugins.hostsSlow": "Die CLI eines Agents antwortet langsam. Skillshare wartet pro Agent bis zu 90 Sekunden.",
|
||||
"plugins.targetsUsable": "{count} von {total} Agents können dieses Plugin aufnehmen",
|
||||
"plugins.targetsOptional": "Ohne ausgewählten Agent wird es nur zu Skillshare hinzugefügt, nicht installiert",
|
||||
"plugins.skillshareOnly": "Nur Skillshare",
|
||||
@@ -1855,6 +1858,8 @@
|
||||
"plugins.reason.grok": "Installiere oder aktualisiere in Grok, um die native Vertrauensfreigabe abzuschließen, und importiere danach.",
|
||||
"plugins.error.cliMissing": "Diese CLI ist nicht installiert oder nicht im PATH der Maschine, auf der Skillshare läuft; installiere sie dort, bevor du Plugins synchronisierst.",
|
||||
"plugins.error.timeout": "Der Befehl hat das Zeitlimit überschritten oder wurde abgebrochen; prüfe den Agent, bevor du es erneut versuchst.",
|
||||
"plugins.error.network": "Die Plugin-Quelle ist nicht erreichbar. Prüfe deine Netzwerkverbindung und versuche es erneut.",
|
||||
"plugins.error.sourceNotFound": "Die Plugin-Quelle wurde nicht gefunden. Prüfe Repository-Adresse und Branch und ob das Repository privat ist.",
|
||||
"plugins.error.commandFailed": "Der Befehl ist fehlgeschlagen; öffne den Agent, um Authentifizierung, Vertrauensfreigabe oder Konfiguration zu klären.",
|
||||
"plugins.error.userScoped": "Die native Plugin-Installation gilt pro Benutzer; nutze den globalen Modus. Projektvorgänge weichen nie auf global aus.",
|
||||
"plugins.error.globalScopeOnly": "Dieser Plugin-Adapter unterstützt nur den globalen Bereich; Projektvorgänge weichen nie auf global aus.",
|
||||
|
||||
@@ -1788,6 +1788,8 @@
|
||||
"plugins.sourceHelp": "Paste owner/repo, an HTTPS Git URL, or a local directory. Preview does not install anything.",
|
||||
"plugins.discover": "Find plugins",
|
||||
"plugins.discovering": "Reading the source…",
|
||||
"plugins.sourceSlow": "The source is on the network, so the first read can take tens of seconds.",
|
||||
"plugins.offline": "You are offline. Plugin sources on the network can be read once you reconnect.",
|
||||
"plugins.choose": "Choose a plugin",
|
||||
"plugins.targets": "Sync to",
|
||||
"plugins.addAgents": "Add to more Agents",
|
||||
@@ -1823,6 +1825,7 @@
|
||||
"plugins.syncHint": "You review the changes first. Nothing is installed or removed until you confirm.",
|
||||
"plugins.syncAgain": "Sync again",
|
||||
"plugins.hostsAsking": "Asking each Agent's CLI…",
|
||||
"plugins.hostsSlow": "An Agent's CLI is responding slowly. Skillshare waits up to 90 seconds for each Agent.",
|
||||
"plugins.targetsUsable": "{count} of {total} Agents can take this plugin",
|
||||
"plugins.targetsOptional": "With no Agent selected, it is only added to Skillshare, not installed",
|
||||
"plugins.skillshareOnly": "Skillshare only",
|
||||
@@ -1855,6 +1858,8 @@
|
||||
"plugins.reason.grok": "Install the plugin in Grok and approve its permissions first. Then choose Import installed here. Skillshare can track and remove it; installation and updates stay in Grok.",
|
||||
"plugins.error.cliMissing": "This CLI is not installed or not on PATH on the machine running Skillshare; install it there before syncing plugins.",
|
||||
"plugins.error.timeout": "The command timed out or was cancelled; check the Agent before retrying.",
|
||||
"plugins.error.network": "Could not reach the plugin source. Check your network connection and try again.",
|
||||
"plugins.error.sourceNotFound": "The plugin source was not found. Check the repository address and branch, and whether the repository is private.",
|
||||
"plugins.error.commandFailed": "Skillshare could not finish checking this tool. The cause is not known. Open it on the computer running Skillshare, check its error message, then refresh here.",
|
||||
"plugins.error.userScoped": "Native plugin installation is user-scoped; use global mode. Project operations never fall back to global.",
|
||||
"plugins.error.globalScopeOnly": "This plugin adapter supports global scope only; project operations never fall back to global.",
|
||||
|
||||
@@ -1788,6 +1788,8 @@
|
||||
"plugins.sourceHelp": "Pega owner/repo, una URL Git HTTPS o un directorio local. La vista previa no instala nada.",
|
||||
"plugins.discover": "Buscar plugins",
|
||||
"plugins.discovering": "Leyendo el origen…",
|
||||
"plugins.sourceSlow": "El origen está en la red, así que la primera lectura puede tardar varias decenas de segundos.",
|
||||
"plugins.offline": "No tienes conexión. Los orígenes de plugins en la red se podrán leer cuando vuelvas a conectarte.",
|
||||
"plugins.choose": "Elegir un plugin",
|
||||
"plugins.targets": "Sincronizar con",
|
||||
"plugins.addAgents": "Añadir a más Agents",
|
||||
@@ -1823,6 +1825,7 @@
|
||||
"plugins.syncHint": "Primero revisas los cambios. No se instala ni se elimina nada hasta que confirmes.",
|
||||
"plugins.syncAgain": "Sincronizar de nuevo",
|
||||
"plugins.hostsAsking": "Consultando la CLI de cada Agent…",
|
||||
"plugins.hostsSlow": "La CLI de un Agent está respondiendo con lentitud. Skillshare espera hasta 90 segundos por cada Agent.",
|
||||
"plugins.targetsUsable": "{count} de {total} Agents pueden recibir este plugin",
|
||||
"plugins.targetsOptional": "Sin ningún Agent seleccionado, solo se añade a Skillshare y no se instala",
|
||||
"plugins.skillshareOnly": "Solo Skillshare",
|
||||
@@ -1855,6 +1858,8 @@
|
||||
"plugins.reason.grok": "Instala o actualiza en Grok para completar la confianza nativa y luego importa.",
|
||||
"plugins.error.cliMissing": "Este CLI no está instalado o no está en el PATH de la máquina que ejecuta Skillshare; instálalo allí antes de sincronizar plugins.",
|
||||
"plugins.error.timeout": "El comando agotó el tiempo o se canceló; revisa el Agent antes de reintentar.",
|
||||
"plugins.error.network": "No se pudo acceder al origen del plugin. Revisa tu conexión de red e inténtalo de nuevo.",
|
||||
"plugins.error.sourceNotFound": "No se encontró el origen del plugin. Revisa la dirección del repositorio y la rama, y si el repositorio es privado.",
|
||||
"plugins.error.commandFailed": "El comando falló; abre el Agent para resolver la autenticación, la confianza o la configuración.",
|
||||
"plugins.error.userScoped": "La instalación nativa de plugins es de ámbito de usuario; usa el modo global. Las operaciones de proyecto nunca recurren al global.",
|
||||
"plugins.error.globalScopeOnly": "Este adaptador de plugins solo admite el ámbito global; las operaciones de proyecto nunca recurren al global.",
|
||||
|
||||
@@ -1788,6 +1788,8 @@
|
||||
"plugins.sourceHelp": "owner/repo، نشانی HTTPS Git یا پوشه محلی را وارد کنید. پیشنمایش چیزی نصب نمیکند.",
|
||||
"plugins.discover": "یافتن افزونهها",
|
||||
"plugins.discovering": "در حال خواندن منبع…",
|
||||
"plugins.sourceSlow": "منبع روی شبکه است، بنابراین اولین خواندن ممکن است چند ده ثانیه طول بکشد.",
|
||||
"plugins.offline": "شما آفلاین هستید. منابع افزونه روی شبکه پس از اتصال دوباره قابل خواندن هستند.",
|
||||
"plugins.choose": "انتخاب افزونه",
|
||||
"plugins.targets": "همگامسازی با",
|
||||
"plugins.addAgents": "افزودن به Agentهای دیگر",
|
||||
@@ -1823,6 +1825,7 @@
|
||||
"plugins.syncHint": "ابتدا تغییرات را بازبینی میکنید. تا زمانی که تأیید نکنید چیزی نصب یا حذف نمیشود.",
|
||||
"plugins.syncAgain": "همگامسازی دوباره",
|
||||
"plugins.hostsAsking": "در حال پرسوجو از CLI هر Agent…",
|
||||
"plugins.hostsSlow": "CLI یکی از Agentها کند پاسخ میدهد. Skillshare برای هر Agent تا ۹۰ ثانیه صبر میکند.",
|
||||
"plugins.targetsUsable": "{count} از {total} Agent میتوانند این plugin را بگیرند",
|
||||
"plugins.targetsOptional": "اگر Agentی انتخاب نشود، فقط به Skillshare اضافه میشود و نصب نمیشود",
|
||||
"plugins.skillshareOnly": "فقط Skillshare",
|
||||
@@ -1855,6 +1858,8 @@
|
||||
"plugins.reason.grok": "در Grok نصب یا بهروزرسانی کنید تا اعتماد بومی کامل شود، سپس وارد کنید.",
|
||||
"plugins.error.cliMissing": "این CLI نصب نشده یا در PATH ماشینی که Skillshare را اجرا میکند نیست؛ پیش از همگامسازی plugin آن را همانجا نصب کنید.",
|
||||
"plugins.error.timeout": "زمان اجرای فرمان تمام شد یا لغو شد؛ پیش از تلاش دوباره وضعیت را در Agent بررسی کنید.",
|
||||
"plugins.error.network": "دسترسی به منبع افزونه ممکن نشد. اتصال شبکه را بررسی کنید و دوباره تلاش کنید.",
|
||||
"plugins.error.sourceNotFound": "منبع افزونه پیدا نشد. نشانی مخزن و شاخه را بررسی کنید و ببینید آیا مخزن خصوصی است.",
|
||||
"plugins.error.commandFailed": "اجرای فرمان ناموفق بود؛ برای حل احراز هویت، اعتماد یا پیکربندی، Agent را باز کنید.",
|
||||
"plugins.error.userScoped": "نصب plugin بومی در محدودهٔ کاربر است؛ از حالت سراسری استفاده کنید. عملیات پروژه هرگز به سراسری بازنمیگردد.",
|
||||
"plugins.error.globalScopeOnly": "این واسط plugin فقط از محدودهٔ سراسری پشتیبانی میکند؛ عملیات پروژه هرگز به سراسری بازنمیگردد.",
|
||||
|
||||
@@ -1788,6 +1788,8 @@
|
||||
"plugins.sourceHelp": "Collez owner/repo, une URL Git HTTPS ou un dossier local. L’aperçu n’installe rien.",
|
||||
"plugins.discover": "Rechercher des plugins",
|
||||
"plugins.discovering": "Lecture de la source…",
|
||||
"plugins.sourceSlow": "La source est sur le réseau : la première lecture peut prendre plusieurs dizaines de secondes.",
|
||||
"plugins.offline": "Vous êtes hors ligne. Les sources de plugins sur le réseau pourront être lues une fois la connexion rétablie.",
|
||||
"plugins.choose": "Choisir un plugin",
|
||||
"plugins.targets": "Synchroniser vers",
|
||||
"plugins.addAgents": "Ajouter à d'autres Agents",
|
||||
@@ -1823,6 +1825,7 @@
|
||||
"plugins.syncHint": "Vous vérifiez d’abord les modifications. Rien n’est installé ni supprimé avant votre confirmation.",
|
||||
"plugins.syncAgain": "Synchroniser à nouveau",
|
||||
"plugins.hostsAsking": "Interrogation de la CLI de chaque Agent…",
|
||||
"plugins.hostsSlow": "La CLI d'un Agent répond lentement. Skillshare attend jusqu'à 90 secondes par Agent.",
|
||||
"plugins.targetsUsable": "{count} Agents sur {total} peuvent recevoir ce plugin",
|
||||
"plugins.targetsOptional": "Sans Agent sélectionné, il est seulement ajouté à Skillshare, sans installation",
|
||||
"plugins.skillshareOnly": "Skillshare seulement",
|
||||
@@ -1855,6 +1858,8 @@
|
||||
"plugins.reason.grok": "Installez ou mettez à jour dans Grok pour établir la confiance native, puis importez.",
|
||||
"plugins.error.cliMissing": "Ce CLI n'est pas installé ou absent du PATH de la machine qui exécute Skillshare ; installez-le là-bas avant de synchroniser des plugins.",
|
||||
"plugins.error.timeout": "La commande a expiré ou a été annulée ; vérifiez l'Agent avant de réessayer.",
|
||||
"plugins.error.network": "Impossible de joindre la source du plugin. Vérifiez votre connexion réseau et réessayez.",
|
||||
"plugins.error.sourceNotFound": "Source du plugin introuvable. Vérifiez l'adresse du dépôt et la branche, et si le dépôt est privé.",
|
||||
"plugins.error.commandFailed": "La commande a échoué ; ouvrez l'Agent pour régler l'authentification, la confiance ou la configuration.",
|
||||
"plugins.error.userScoped": "L'installation native des plugins est à portée utilisateur ; utilisez le mode global. Les opérations de projet ne basculent jamais vers le global.",
|
||||
"plugins.error.globalScopeOnly": "Cet adaptateur de plugins ne prend en charge que la portée globale ; les opérations de projet ne basculent jamais vers le global.",
|
||||
|
||||
@@ -1788,6 +1788,8 @@
|
||||
"plugins.sourceHelp": "Tempel owner/repo, URL Git HTTPS, atau direktori lokal. Pratinjau tidak memasang apa pun.",
|
||||
"plugins.discover": "Cari plugin",
|
||||
"plugins.discovering": "Membaca sumber…",
|
||||
"plugins.sourceSlow": "Sumber ada di jaringan, jadi pembacaan pertama bisa memakan waktu puluhan detik.",
|
||||
"plugins.offline": "Anda sedang offline. Sumber plugin di jaringan bisa dibaca setelah tersambung kembali.",
|
||||
"plugins.choose": "Pilih plugin",
|
||||
"plugins.targets": "Sinkronkan ke",
|
||||
"plugins.addAgents": "Tambahkan ke Agent lain",
|
||||
@@ -1823,6 +1825,7 @@
|
||||
"plugins.syncHint": "Anda meninjau perubahan terlebih dahulu. Tidak ada yang dipasang atau dihapus sebelum Anda mengonfirmasi.",
|
||||
"plugins.syncAgain": "Sinkronkan lagi",
|
||||
"plugins.hostsAsking": "Menanyakan CLI setiap Agent…",
|
||||
"plugins.hostsSlow": "CLI salah satu Agent merespons lambat. Skillshare menunggu hingga 90 detik untuk setiap Agent.",
|
||||
"plugins.targetsUsable": "{count} dari {total} Agent bisa menerima plugin ini",
|
||||
"plugins.targetsOptional": "Tanpa Agent yang dipilih, plugin hanya ditambahkan ke Skillshare, tidak dipasang",
|
||||
"plugins.skillshareOnly": "Hanya Skillshare",
|
||||
@@ -1855,6 +1858,8 @@
|
||||
"plugins.reason.grok": "Pasang atau perbarui di Grok untuk menyelesaikan kepercayaan native, lalu impor.",
|
||||
"plugins.error.cliMissing": "CLI ini belum terpasang atau tidak ada di PATH mesin yang menjalankan Skillshare; pasang di sana sebelum menyinkronkan plugin.",
|
||||
"plugins.error.timeout": "Perintah kehabisan waktu atau dibatalkan; periksa Agent sebelum mencoba lagi.",
|
||||
"plugins.error.network": "Tidak dapat menjangkau sumber plugin. Periksa koneksi jaringan Anda lalu coba lagi.",
|
||||
"plugins.error.sourceNotFound": "Sumber plugin tidak ditemukan. Periksa alamat repositori dan branch, serta apakah repositori itu privat.",
|
||||
"plugins.error.commandFailed": "Perintah gagal; buka Agent untuk menyelesaikan autentikasi, kepercayaan, atau konfigurasi.",
|
||||
"plugins.error.userScoped": "Pemasangan plugin native berlingkup pengguna; gunakan mode global. Operasi proyek tidak pernah beralih ke global.",
|
||||
"plugins.error.globalScopeOnly": "Adapter plugin ini hanya mendukung lingkup global; operasi proyek tidak pernah beralih ke global.",
|
||||
|
||||
@@ -1788,6 +1788,8 @@
|
||||
"plugins.sourceHelp": "owner/repo、HTTPS Git URL、ローカルディレクトリを入力します。プレビューではインストールしません。",
|
||||
"plugins.discover": "プラグインを探す",
|
||||
"plugins.discovering": "ソースを読み込んでいます…",
|
||||
"plugins.sourceSlow": "ソースはネットワーク上にあるため、初回の読み込みには数十秒かかることがあります。",
|
||||
"plugins.offline": "オフラインです。ネットワーク上のプラグインのソースは、再接続すると読み込めます。",
|
||||
"plugins.choose": "プラグインを選択",
|
||||
"plugins.targets": "同期先",
|
||||
"plugins.addAgents": "他の Agent に追加",
|
||||
@@ -1823,6 +1825,7 @@
|
||||
"plugins.syncHint": "先に変更内容を確認します。確定するまでインストールも削除も行われません。",
|
||||
"plugins.syncAgain": "もう一度同期",
|
||||
"plugins.hostsAsking": "各 Agent の CLI に問い合わせ中…",
|
||||
"plugins.hostsSlow": "ある Agent の CLI の応答が遅れています。Skillshare は Agent ごとに最大 90 秒待ちます。",
|
||||
"plugins.targetsUsable": "{total} 件中 {count} 件の Agent がこの plugin を利用できます",
|
||||
"plugins.targetsOptional": "Agent を選ばない場合は Skillshare に追加するだけで、インストールしません",
|
||||
"plugins.skillshareOnly": "Skillshare のみ",
|
||||
@@ -1855,6 +1858,8 @@
|
||||
"plugins.reason.grok": "Grok でインストールまたは更新してネイティブの信頼を完了してから、インポートしてください。",
|
||||
"plugins.error.cliMissing": "この CLI はインストールされていないか、Skillshare を実行しているマシンの PATH にありません。plugin を同期する前に、そのマシンにインストールしてください。",
|
||||
"plugins.error.timeout": "コマンドがタイムアウトまたはキャンセルされました。Agent の状態を確認してから再試行してください。",
|
||||
"plugins.error.network": "プラグインのソースに接続できませんでした。ネットワーク接続を確認して、もう一度お試しください。",
|
||||
"plugins.error.sourceNotFound": "プラグインのソースが見つかりません。リポジトリのアドレスとブランチ、リポジトリが非公開でないかを確認してください。",
|
||||
"plugins.error.commandFailed": "コマンドが失敗しました。認証、信頼、設定は Agent で解決してください。",
|
||||
"plugins.error.userScoped": "ネイティブ plugin のインストールはユーザー単位です。グローバルモードを使ってください。プロジェクト操作がグローバルにフォールバックすることはありません。",
|
||||
"plugins.error.globalScopeOnly": "この plugin アダプターはグローバル範囲のみ対応します。プロジェクト操作がグローバルにフォールバックすることはありません。",
|
||||
|
||||
@@ -1788,6 +1788,8 @@
|
||||
"plugins.sourceHelp": "owner/repo, HTTPS Git URL 또는 로컬 디렉터리를 입력하세요. 미리보기는 설치하지 않습니다.",
|
||||
"plugins.discover": "플러그인 찾기",
|
||||
"plugins.discovering": "소스를 읽는 중…",
|
||||
"plugins.sourceSlow": "소스가 네트워크에 있어 처음 읽을 때 수십 초가 걸릴 수 있습니다.",
|
||||
"plugins.offline": "오프라인 상태입니다. 네트워크에 있는 플러그인 소스는 다시 연결되면 읽을 수 있습니다.",
|
||||
"plugins.choose": "플러그인 선택",
|
||||
"plugins.targets": "동기화 대상",
|
||||
"plugins.addAgents": "다른 Agent에 추가",
|
||||
@@ -1823,6 +1825,7 @@
|
||||
"plugins.syncHint": "먼저 변경 내용을 검토합니다. 확인하기 전에는 아무것도 설치하거나 제거하지 않습니다.",
|
||||
"plugins.syncAgain": "다시 동기화",
|
||||
"plugins.hostsAsking": "각 Agent의 CLI에 확인하는 중…",
|
||||
"plugins.hostsSlow": "어떤 Agent의 CLI가 느리게 응답하고 있습니다. Skillshare는 Agent마다 최대 90초까지 기다립니다.",
|
||||
"plugins.targetsUsable": "Agent {total}개 중 {count}개가 이 plugin을 받을 수 있습니다",
|
||||
"plugins.targetsOptional": "Agent를 선택하지 않으면 Skillshare에만 추가되고 설치되지 않습니다",
|
||||
"plugins.skillshareOnly": "Skillshare만",
|
||||
@@ -1855,6 +1858,8 @@
|
||||
"plugins.reason.grok": "Grok에서 설치하거나 업데이트해 네이티브 신뢰를 완료한 뒤 가져오세요.",
|
||||
"plugins.error.cliMissing": "이 CLI가 설치되어 있지 않거나 Skillshare를 실행하는 머신의 PATH에 없습니다. plugin을 동기화하기 전에 해당 머신에 설치하세요.",
|
||||
"plugins.error.timeout": "명령이 시간 초과되었거나 취소되었습니다. Agent에서 상태를 확인한 뒤 다시 시도하세요.",
|
||||
"plugins.error.network": "플러그인 소스에 연결할 수 없습니다. 네트워크 연결을 확인한 뒤 다시 시도하세요.",
|
||||
"plugins.error.sourceNotFound": "플러그인 소스를 찾을 수 없습니다. 저장소 주소와 브랜치, 그리고 저장소가 비공개인지 확인하세요.",
|
||||
"plugins.error.commandFailed": "명령이 실패했습니다. 인증, 신뢰, 설정은 Agent에서 해결하세요.",
|
||||
"plugins.error.userScoped": "네이티브 plugin 설치는 사용자 범위입니다. 전역 모드를 사용하세요. 프로젝트 작업은 전역으로 대체되지 않습니다.",
|
||||
"plugins.error.globalScopeOnly": "이 plugin 어댑터는 전역 범위만 지원합니다. 프로젝트 작업은 전역으로 대체되지 않습니다.",
|
||||
|
||||
@@ -1788,6 +1788,8 @@
|
||||
"plugins.sourceHelp": "Cole owner/repo, uma URL Git HTTPS ou um diretório local. A prévia não instala nada.",
|
||||
"plugins.discover": "Buscar plugins",
|
||||
"plugins.discovering": "Lendo a origem…",
|
||||
"plugins.sourceSlow": "A origem está na rede, então a primeira leitura pode levar dezenas de segundos.",
|
||||
"plugins.offline": "Você está offline. Origens de plugins na rede poderão ser lidas quando a conexão voltar.",
|
||||
"plugins.choose": "Escolher plugin",
|
||||
"plugins.targets": "Sincronizar com",
|
||||
"plugins.addAgents": "Adicionar a mais Agents",
|
||||
@@ -1823,6 +1825,7 @@
|
||||
"plugins.syncHint": "Você revisa as alterações primeiro. Nada é instalado ou removido até você confirmar.",
|
||||
"plugins.syncAgain": "Sincronizar novamente",
|
||||
"plugins.hostsAsking": "Consultando a CLI de cada Agent…",
|
||||
"plugins.hostsSlow": "A CLI de um Agent está respondendo devagar. O Skillshare espera até 90 segundos por Agent.",
|
||||
"plugins.targetsUsable": "{count} de {total} Agents podem receber este plugin",
|
||||
"plugins.targetsOptional": "Sem nenhum Agent selecionado, ele só é adicionado ao Skillshare, sem instalar",
|
||||
"plugins.skillshareOnly": "Só Skillshare",
|
||||
@@ -1855,6 +1858,8 @@
|
||||
"plugins.reason.grok": "Instale ou atualize no Grok para concluir a confiança nativa e depois importe.",
|
||||
"plugins.error.cliMissing": "Este CLI não está instalado ou não está no PATH da máquina que executa o Skillshare; instale-o lá antes de sincronizar plugins.",
|
||||
"plugins.error.timeout": "O comando expirou ou foi cancelado; verifique o Agent antes de tentar de novo.",
|
||||
"plugins.error.network": "Não foi possível acessar a origem do plugin. Verifique sua conexão de rede e tente de novo.",
|
||||
"plugins.error.sourceNotFound": "A origem do plugin não foi encontrada. Verifique o endereço do repositório e a branch, e se o repositório é privado.",
|
||||
"plugins.error.commandFailed": "O comando falhou; abra o Agent para resolver autenticação, confiança ou configuração.",
|
||||
"plugins.error.userScoped": "A instalação nativa de plugins é de escopo do usuário; use o modo global. Operações de projeto nunca recorrem ao global.",
|
||||
"plugins.error.globalScopeOnly": "Este adaptador de plugins só oferece suporte ao escopo global; operações de projeto nunca recorrem ao global.",
|
||||
|
||||
@@ -1788,6 +1788,8 @@
|
||||
"plugins.sourceHelp": "粘贴 owner/repo、HTTPS Git 地址或本地目录。预览不会安装任何内容。",
|
||||
"plugins.discover": "查找 plugins",
|
||||
"plugins.discovering": "正在读取来源…",
|
||||
"plugins.sourceSlow": "来源在网络上,第一次读取可能需要几十秒。",
|
||||
"plugins.offline": "当前没有网络连接,连上网络后才能读取网络上的 plugin 来源。",
|
||||
"plugins.choose": "选择 plugin",
|
||||
"plugins.targets": "同步到",
|
||||
"plugins.addAgents": "添加到其他 Agent",
|
||||
@@ -1823,6 +1825,7 @@
|
||||
"plugins.syncHint": "点击后会先让你确认,才会真正安装或移除。",
|
||||
"plugins.syncAgain": "再同步一次",
|
||||
"plugins.hostsAsking": "正在询问各 Agent 的 CLI…",
|
||||
"plugins.hostsSlow": "有 Agent 的 CLI 响应较慢。Skillshare 每个 Agent 最多会等 90 秒。",
|
||||
"plugins.targetsUsable": "{total} 个 Agent 中有 {count} 个可以装这个 plugin",
|
||||
"plugins.targetsOptional": "未选 Agent 时,只会加入 Skillshare,不会安装",
|
||||
"plugins.skillshareOnly": "只加入 Skillshare",
|
||||
@@ -1855,6 +1858,8 @@
|
||||
"plugins.reason.grok": "请先在 Grok 安装 plugin 并确认允许使用,再到这里选择“导入已安装”。Skillshare 可以记录与移除它;安装和更新仍需在 Grok 内操作。",
|
||||
"plugins.error.cliMissing": "这个 CLI 没有安装,或不在运行 Skillshare 这台机器的 PATH 上;要先在那里安装才能同步 plugin。",
|
||||
"plugins.error.timeout": "命令超时或被取消;请先在 Agent 内确认状态再重试。",
|
||||
"plugins.error.network": "无法连接 plugin 来源。请检查网络连接后重试。",
|
||||
"plugins.error.sourceNotFound": "找不到 plugin 来源。请确认仓库地址和分支,以及仓库是否为私有。",
|
||||
"plugins.error.commandFailed": "Skillshare 无法完成这个工具的检查,目前还不能判断原因。请在运行 Skillshare 的电脑打开该工具,查看它的错误信息,处理后再刷新。",
|
||||
"plugins.error.userScoped": "原生 plugin 安装属于用户范围,请用全局模式。项目操作不会回退到全局。",
|
||||
"plugins.error.globalScopeOnly": "这个 plugin 适配只支持全局范围;项目操作不会回退到全局。",
|
||||
|
||||
@@ -1788,6 +1788,8 @@
|
||||
"plugins.sourceHelp": "貼上 owner/repo、HTTPS Git 網址或本機目錄。預覽不會安裝任何內容。",
|
||||
"plugins.discover": "尋找 plugins",
|
||||
"plugins.discovering": "正在讀取來源…",
|
||||
"plugins.sourceSlow": "來源在網路上,第一次讀取可能要幾十秒。",
|
||||
"plugins.offline": "目前沒有網路連線,連上網路後才能讀取網路上的 plugin 來源。",
|
||||
"plugins.choose": "選擇 plugin",
|
||||
"plugins.targets": "同步到",
|
||||
"plugins.addAgents": "加入其他 Agent",
|
||||
@@ -1823,6 +1825,7 @@
|
||||
"plugins.syncHint": "按下之後會先讓你確認,才會真的安裝或移除。",
|
||||
"plugins.syncAgain": "再同步一次",
|
||||
"plugins.hostsAsking": "正在詢問各 Agent 的 CLI…",
|
||||
"plugins.hostsSlow": "有 Agent 的 CLI 回應比較慢。Skillshare 每個 Agent 最多會等 90 秒。",
|
||||
"plugins.targetsUsable": "{total} 個 Agent 中有 {count} 個可以裝這個 plugin",
|
||||
"plugins.targetsOptional": "未選 Agent 時,只會加入 Skillshare,不會安裝",
|
||||
"plugins.skillshareOnly": "只加入 Skillshare",
|
||||
@@ -1855,6 +1858,8 @@
|
||||
"plugins.reason.grok": "請先在 Grok 安裝 plugin 並確認允許使用,再到這裡選「匯入已安裝」。Skillshare 可以記錄與移除它;安裝和更新仍需在 Grok 內操作。",
|
||||
"plugins.error.cliMissing": "這個 CLI 沒有安裝,或不在執行 Skillshare 這台機器的 PATH 上;要先在那裡安裝才能同步 plugin。",
|
||||
"plugins.error.timeout": "指令逾時或被取消;請先在 Agent 內確認狀態再重試。",
|
||||
"plugins.error.network": "連不到 plugin 來源。請確認網路連線後再試一次。",
|
||||
"plugins.error.sourceNotFound": "找不到 plugin 來源。請確認儲存庫網址和分支,以及儲存庫是否為私人。",
|
||||
"plugins.error.commandFailed": "Skillshare 無法完成這個工具的檢查,目前還不能判斷原因。請在執行 Skillshare 的電腦開啟該工具,查看它的錯誤訊息,處理後再按重新整理。",
|
||||
"plugins.error.userScoped": "原生 plugin 安裝屬於使用者範圍,請用全域模式。專案操作不會退回全域。",
|
||||
"plugins.error.globalScopeOnly": "這個 plugin 介接只支援全域範圍;專案操作不會退回全域。",
|
||||
|
||||
@@ -3,6 +3,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import PluginsPage from './PluginsPage';
|
||||
import { pluginsApi } from '../api/plugins';
|
||||
import { ApiError } from '../api/client';
|
||||
|
||||
vi.mock('../api/plugins', async (importOriginal) => ({ ...await importOriginal<typeof import('../api/plugins')>(), pluginsApi: { list: vi.fn(), files: vi.fn(), file: vi.fn(), discover: vi.fn(), preview: vi.fn(), apply: vi.fn() } }));
|
||||
vi.mock('../i18n', () => ({ useT: () => (key: string) => key }));
|
||||
@@ -72,6 +73,14 @@ describe('PluginsPage', () => {
|
||||
fireEvent.click(claude);
|
||||
await waitFor(() => expect(pluginsApi.preview).toHaveBeenCalledWith({ action: 'add', source: 'https://github.com/owner/demo', sourceRef: undefined, entry: undefined, plugin: 'demo', name: 'demo', targets: ['claude'] }));
|
||||
});
|
||||
it('asks for a managed plugin by name, and says why its source could not be read', async () => {
|
||||
vi.mocked(pluginsApi.list).mockResolvedValue({ targetDefinitions: [{ target: 'codex', label: 'codex', project: false, operations: ['add', 'sync'] }], packages: { demo: { bindings: { codex: { id: 'demo@market', source: 'https://github.com/owner/demo.git', plugin: 'demo' } } } }, hosts: [] });
|
||||
vi.mocked(pluginsApi.discover).mockRejectedValue(new ApiError(400, 'download plugin source: could not reach the plugin source', { code: 'plugins.error.network' }));
|
||||
mount();
|
||||
fireEvent.click(await screen.findByRole('button', { name: 'mcp.chooseAgents' }));
|
||||
expect(await screen.findByText('plugins.error.network')).toBeInTheDocument();
|
||||
expect(pluginsApi.discover).toHaveBeenCalledWith('https://github.com/owner/demo.git', undefined, undefined, 'demo');
|
||||
});
|
||||
it('opens the files of a plugin that has a local copy, on its README', async () => {
|
||||
vi.mocked(pluginsApi.list).mockResolvedValue({ targetDefinitions: [{ target: 'codex', label: 'Codex', project: false, operations: ['add', 'sync'] }], packages: { demo: { bindings: { codex: { id: 'demo@market', source: 'owner/demo' } } } }, hosts: [] });
|
||||
vi.mocked(pluginsApi.files).mockResolvedValue({ files: ['README.md', 'skills/hi/SKILL.md'] });
|
||||
|
||||
@@ -17,6 +17,7 @@ import PluginFilesDialog from '../components/plugins/PluginFilesDialog';
|
||||
import PluginAgents from '../components/plugins/PluginAgents';
|
||||
import PluginList, { VersionChange } from '../components/plugins/PluginList';
|
||||
import { useT } from '../i18n';
|
||||
import { useSlow } from '../hooks/useSlow';
|
||||
import { queryKeys } from '../lib/queryKeys';
|
||||
|
||||
export default function PluginsPage() {
|
||||
@@ -27,6 +28,7 @@ export default function PluginsPage() {
|
||||
const quick = useQuery({ queryKey: queryKeys.pluginPackages, queryFn: () => pluginsApi.list(false) });
|
||||
const full = useQuery({ queryKey: queryKeys.plugins, queryFn: () => pluginsApi.list() });
|
||||
const hostsReady = !!full.data;
|
||||
const hostsSlow = useSlow(!hostsReady, 10000);
|
||||
const base = quick.data ?? full.data;
|
||||
const data = base && { ...base, hosts: full.data?.hosts ?? [] };
|
||||
const error = quick.error ?? full.error;
|
||||
@@ -181,6 +183,7 @@ export default function PluginsPage() {
|
||||
<div className="db overflow-y-auto">
|
||||
<div className="ss-list">
|
||||
{!hostsReady && <div className="ss-r gap-2 text-[13px] text-ink-2"><Spinner size="sm" />{t('plugins.hostsAsking')}</div>}
|
||||
{!hostsReady && hostsSlow && <div className="ss-r !min-h-0 text-xs text-ink-3">{t('plugins.hostsSlow')}</div>}
|
||||
{data?.hosts.map((h) => {
|
||||
const locked = !pluginTargets[h.target]?.operations.includes('import');
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user