-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadmin.ts
More file actions
40 lines (37 loc) · 1.82 KB
/
Copy pathadmin.ts
File metadata and controls
40 lines (37 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import type { PluginConfig } from "../config/settings.js";
import type { PluginCredentialField, PluginKind } from "./manifest.js";
export type PluginDescriptor = {
id: string;
name: string;
kind?: PluginKind;
description?: string;
credentials: PluginCredentialField[];
// For kind:"agent" plugins — the profiles contributed, shown so the user can
// see which sub-agents a plugin provides before enabling it.
agentProfiles?: { id: string; description?: string }[];
/**
* True when discovery found the plugin but code is not imported yet (project
* or path origin still untrusted). Enabling records trust and full-loads.
*/
needsTrust?: boolean;
/** True for a trusted path-origin plugin, whose global grant can be withdrawn. */
canRevokeTrust?: boolean;
};
export type VerifyResult = { ok: boolean; message: string };
export type AddPathResult = { ok: boolean; message: string; id?: string };
export type PluginsAdmin = {
list: () => PluginDescriptor[];
getConfig: () => Record<string, PluginConfig>;
getWebOverride: () => string | undefined;
// A trust-grant load (enabling a metadata-only plugin) can surface skill-miss
// and similar warnings; the optional message lets the caller show them
// instead of dropping them on the floor.
saveConfig: (id: string, cfg: PluginConfig) => Promise<{ message?: string } | void> | void;
setWebOverride: (id: string | undefined) => Promise<void> | void;
verify: (id: string, credentials: Record<string, string>) => Promise<VerifyResult>;
// Register a plugin from an arbitrary file/dir path, persisting it so it loads
// on future startups. Returns the new plugin id on success.
addPath: (path: string) => Promise<AddPathResult>;
// Withdraw the global trust grant for a path-origin plugin and disable it.
revokeTrust: (id: string) => Promise<VerifyResult>;
};