@syncshio/kano-plugin-sdk 0.0.0-stage → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +265 -2
- package/dist/api/contributions.d.ts +140 -0
- package/dist/api/launch-tools.d.ts +136 -0
- package/dist/api/types.d.ts +178 -0
- package/dist/contracts/app-context.d.ts +32 -0
- package/dist/contracts/app-lifecycle.d.ts +119 -0
- package/dist/contracts/app-plugin.d.ts +72 -0
- package/dist/contracts/drop.d.ts +35 -0
- package/dist/contracts/install-recipe.d.ts +140 -0
- package/dist/contracts/launch-pipeline.d.ts +272 -0
- package/dist/contracts/launch.d.ts +137 -0
- package/dist/contracts/model-market.d.ts +112 -0
- package/dist/contracts/models.d.ts +119 -0
- package/dist/contracts/params.d.ts +150 -0
- package/dist/contracts/providers.d.ts +344 -0
- package/dist/contracts/session.d.ts +64 -0
- package/dist/helpers/define-plugin.d.ts +2 -0
- package/dist/helpers/params.d.ts +14 -0
- package/dist/host.d.ts +626 -0
- package/dist/host.js +94 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +629 -0
- package/dist/manifest/plugin-manifest.d.ts +33 -0
- package/dist/manifest/validate.d.ts +12 -0
- package/dist/versions.d.ts +12 -0
- package/package.json +40 -4
- package/src/schemas/plugin-manifest.schema.json +262 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import type { PluginHttpApi, PluginFsApi, PluginExtensionsApi } from './launch-tools';
|
|
2
|
+
import type { ModelInfoFromBackend } from '../contracts/models';
|
|
3
|
+
import type { AppLifecycleEventMap } from '../contracts/app-lifecycle';
|
|
4
|
+
import type { PluginSessionsApi } from '../contracts/session';
|
|
5
|
+
import type { PluginDropsApi } from '../contracts/drop';
|
|
6
|
+
import type { InstallRecipe } from '../contracts/install-recipe';
|
|
7
|
+
import type { PluginContributionApi, PluginPage, PluginUiSlot, PluginWorkspaceTab, PluginTasksApi, PluginServicesApi } from './contributions';
|
|
8
|
+
export interface PluginWorkspaceContext {
|
|
9
|
+
pluginId: string;
|
|
10
|
+
appId?: string;
|
|
11
|
+
workspaceId?: string;
|
|
12
|
+
tabId?: string;
|
|
13
|
+
params?: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
export interface PluginSubscriptionToken {
|
|
16
|
+
id: string;
|
|
17
|
+
dispose(): void;
|
|
18
|
+
}
|
|
19
|
+
export interface PluginHardwareGpuSnapshot {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
vramUsedBytes: number | null;
|
|
23
|
+
vramTotalBytes: number | null;
|
|
24
|
+
vramUsedPercent: number | null;
|
|
25
|
+
utilizationPercent?: number;
|
|
26
|
+
temperatureC?: number;
|
|
27
|
+
powerWatts?: number;
|
|
28
|
+
}
|
|
29
|
+
/** Missing measurements are null; measured zero values are preserved. */
|
|
30
|
+
export interface PluginHardwareSnapshot {
|
|
31
|
+
serverId: string;
|
|
32
|
+
serverName: string;
|
|
33
|
+
isRemote: boolean;
|
|
34
|
+
connected: boolean;
|
|
35
|
+
/** Unix timestamp in milliseconds of the last successful sample. */
|
|
36
|
+
updatedAt: number;
|
|
37
|
+
cpuPercent: number | null;
|
|
38
|
+
memory: {
|
|
39
|
+
usedBytes: number | null;
|
|
40
|
+
totalBytes: number | null;
|
|
41
|
+
usedPercent: number | null;
|
|
42
|
+
};
|
|
43
|
+
gpus: PluginHardwareGpuSnapshot[];
|
|
44
|
+
}
|
|
45
|
+
/** Requires permissions.systemMetrics. Observers share the current server's sampler. */
|
|
46
|
+
export interface PluginSystemApi {
|
|
47
|
+
getSnapshot(): PluginHardwareSnapshot | null;
|
|
48
|
+
/** Delivers the cached sample (or null) immediately, then subsequent changes. */
|
|
49
|
+
observeHardware(listener: (snapshot: PluginHardwareSnapshot | null) => void): PluginSubscriptionToken;
|
|
50
|
+
refresh(): Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
export interface PluginMetaApi {
|
|
53
|
+
isRemoteServer(): boolean;
|
|
54
|
+
getPluginId(): string;
|
|
55
|
+
getPluginVersion(): string;
|
|
56
|
+
getKanoVersion(): string;
|
|
57
|
+
getWorkspaceContext(): PluginWorkspaceContext | null;
|
|
58
|
+
}
|
|
59
|
+
export interface PluginRpcApi {
|
|
60
|
+
request<T = unknown>(method: string, params?: unknown, options?: {
|
|
61
|
+
timeoutMs?: number;
|
|
62
|
+
retryAfterDispatch?: boolean;
|
|
63
|
+
}): Promise<T>;
|
|
64
|
+
subscribe(method: string, handler: (params: unknown) => void): PluginSubscriptionToken;
|
|
65
|
+
unsubscribe(token: PluginSubscriptionToken): void;
|
|
66
|
+
}
|
|
67
|
+
export interface PluginStorageApi {
|
|
68
|
+
get<T = unknown>(key: string): Promise<T | null>;
|
|
69
|
+
set<T = unknown>(key: string, value: T): Promise<void>;
|
|
70
|
+
delete(key: string): Promise<void>;
|
|
71
|
+
namespace(scopeId: string): PluginStorageApi;
|
|
72
|
+
}
|
|
73
|
+
export interface PluginShellApi {
|
|
74
|
+
openExternal(url: string): Promise<void>;
|
|
75
|
+
openFolder(path: string): Promise<void>;
|
|
76
|
+
showItemInFolder(path: string): void;
|
|
77
|
+
}
|
|
78
|
+
export interface PluginEventsApi {
|
|
79
|
+
emit<T = unknown>(event: string, payload: T): void;
|
|
80
|
+
on<T = unknown>(event: string, handler: (payload: T) => void): PluginSubscriptionToken;
|
|
81
|
+
off(token: PluginSubscriptionToken): void;
|
|
82
|
+
}
|
|
83
|
+
export interface PluginAppLifecycleApi {
|
|
84
|
+
on<TEvent extends keyof AppLifecycleEventMap>(event: TEvent, handler: (payload: AppLifecycleEventMap[TEvent]) => void): PluginSubscriptionToken;
|
|
85
|
+
off(token: PluginSubscriptionToken): void;
|
|
86
|
+
}
|
|
87
|
+
export interface PluginLoggerApi {
|
|
88
|
+
debug(message: string, ...args: unknown[]): void;
|
|
89
|
+
info(message: string, ...args: unknown[]): void;
|
|
90
|
+
warn(message: string, ...args: unknown[]): void;
|
|
91
|
+
error(message: string, ...args: unknown[]): void;
|
|
92
|
+
}
|
|
93
|
+
export interface PluginDownload {
|
|
94
|
+
id: string;
|
|
95
|
+
name: string;
|
|
96
|
+
status: 'pending' | 'downloading' | 'paused' | 'completed' | 'failed' | 'cancelled';
|
|
97
|
+
progress: number;
|
|
98
|
+
downloaded: number;
|
|
99
|
+
total: number;
|
|
100
|
+
filePath?: string;
|
|
101
|
+
error?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface PluginConfirmOptions {
|
|
104
|
+
message: string;
|
|
105
|
+
title?: string;
|
|
106
|
+
confirmText?: string;
|
|
107
|
+
cancelText?: string;
|
|
108
|
+
type?: 'info' | 'warning' | 'danger';
|
|
109
|
+
}
|
|
110
|
+
export interface PluginApi extends PluginContributionApi {
|
|
111
|
+
system: PluginSystemApi;
|
|
112
|
+
fs: PluginFsApi;
|
|
113
|
+
http: PluginHttpApi;
|
|
114
|
+
extensions: PluginExtensionsApi;
|
|
115
|
+
models: {
|
|
116
|
+
list(appId: string): Promise<ModelInfoFromBackend[]>;
|
|
117
|
+
openMarket(search: string, appId?: string, categoryId?: string): Promise<void>;
|
|
118
|
+
};
|
|
119
|
+
downloads: {
|
|
120
|
+
enqueue(input: {
|
|
121
|
+
url: string;
|
|
122
|
+
directory: string;
|
|
123
|
+
filename?: string;
|
|
124
|
+
appId?: string;
|
|
125
|
+
}): Promise<string>;
|
|
126
|
+
list(): readonly PluginDownload[];
|
|
127
|
+
observe(onChange: (items: readonly PluginDownload[]) => void): PluginSubscriptionToken;
|
|
128
|
+
};
|
|
129
|
+
/** Register timers, watchers and other resources for cleanup on deactivate or failed activation. */
|
|
130
|
+
onDispose(dispose: () => void | Promise<void>): PluginSubscriptionToken;
|
|
131
|
+
ui: {
|
|
132
|
+
openDirectory(options?: {
|
|
133
|
+
title?: string;
|
|
134
|
+
defaultPath?: string;
|
|
135
|
+
}): Promise<string | null>;
|
|
136
|
+
registerTab(tab: PluginWorkspaceTab): PluginSubscriptionToken;
|
|
137
|
+
registerPage(page: PluginPage): PluginSubscriptionToken;
|
|
138
|
+
/** Opens a local page ID or a qualified "pluginId:pageId" in the current workspace. */
|
|
139
|
+
openPage(pageId: string): Promise<void>;
|
|
140
|
+
/** Opens the workspace's server and hardware management page. */
|
|
141
|
+
openServerManager(): Promise<void>;
|
|
142
|
+
registerSlot(contribution: PluginUiSlot): PluginSubscriptionToken;
|
|
143
|
+
openFile(options?: {
|
|
144
|
+
title?: string;
|
|
145
|
+
defaultPath?: string;
|
|
146
|
+
filters?: {
|
|
147
|
+
name: string;
|
|
148
|
+
extensions: string[];
|
|
149
|
+
}[];
|
|
150
|
+
}): Promise<string | null>;
|
|
151
|
+
confirm(options: string | PluginConfirmOptions): Promise<boolean>;
|
|
152
|
+
toast: PluginToast;
|
|
153
|
+
switchTab(tabId: string): void;
|
|
154
|
+
notifyDesktop(title: string, body: string): void;
|
|
155
|
+
downloadTextFile(filename: string, content: string, type?: string): void;
|
|
156
|
+
};
|
|
157
|
+
meta: PluginMetaApi;
|
|
158
|
+
rpc: PluginRpcApi;
|
|
159
|
+
storage: PluginStorageApi;
|
|
160
|
+
shell: PluginShellApi;
|
|
161
|
+
market: {
|
|
162
|
+
registerRecipe(recipe: InstallRecipe): PluginSubscriptionToken;
|
|
163
|
+
};
|
|
164
|
+
services: PluginServicesApi;
|
|
165
|
+
tasks: PluginTasksApi;
|
|
166
|
+
events: PluginEventsApi;
|
|
167
|
+
drops: PluginDropsApi;
|
|
168
|
+
appLifecycle: PluginAppLifecycleApi;
|
|
169
|
+
sessions: PluginSessionsApi;
|
|
170
|
+
logger: PluginLoggerApi;
|
|
171
|
+
}
|
|
172
|
+
export type ToastKind = 'info' | 'success' | 'warning' | 'error';
|
|
173
|
+
export type PluginToast = Record<ToastKind, (title: string, message?: string, options?: {
|
|
174
|
+
duration?: number;
|
|
175
|
+
}) => string> & {
|
|
176
|
+
remove(id: string): void;
|
|
177
|
+
exception(title: string, cause: unknown, fallbackMessage?: string): string;
|
|
178
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { BinaryInstalledVersion, NpmInstalledVersion } from './providers';
|
|
2
|
+
export interface AppContext {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
path: string;
|
|
6
|
+
params: Record<string, unknown>;
|
|
7
|
+
env?: Record<string, string>;
|
|
8
|
+
pythonPath?: string;
|
|
9
|
+
}
|
|
10
|
+
export type AppStatus = 'stopped' | 'starting' | 'running' | 'stopping' | 'error';
|
|
11
|
+
/** Public metadata available to other plugins on the active execution server. */
|
|
12
|
+
export interface PublicAppInstance {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
pluginId: string;
|
|
16
|
+
status: AppStatus;
|
|
17
|
+
webUrl?: string;
|
|
18
|
+
icon?: string;
|
|
19
|
+
color?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface AppInstance extends AppContext {
|
|
22
|
+
pythonPackageIndex?: string;
|
|
23
|
+
nodePath?: string;
|
|
24
|
+
npmVersion?: NpmInstalledVersion;
|
|
25
|
+
binaryVersions?: BinaryInstalledVersion[];
|
|
26
|
+
pluginId: string;
|
|
27
|
+
status: AppStatus;
|
|
28
|
+
processId?: string;
|
|
29
|
+
/** Backend process execution ID; processId is the displayed OS PID. */
|
|
30
|
+
executionId?: string;
|
|
31
|
+
webUrl?: string;
|
|
32
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { AppLaunchPlan } from './launch-pipeline';
|
|
2
|
+
import type { LaunchSubPhase, LaunchSessionStatus } from './session';
|
|
3
|
+
interface LaunchEventIdentity {
|
|
4
|
+
appId: string;
|
|
5
|
+
runId: string;
|
|
6
|
+
seq: number;
|
|
7
|
+
}
|
|
8
|
+
export interface AppLifecycleEventMap {
|
|
9
|
+
'launch:phase-changed': LaunchEventIdentity & {
|
|
10
|
+
phase: LaunchSubPhase;
|
|
11
|
+
previousPhase: LaunchSubPhase;
|
|
12
|
+
status: LaunchSessionStatus;
|
|
13
|
+
};
|
|
14
|
+
'launch:diagnostics-updated': LaunchEventIdentity & {
|
|
15
|
+
plan: AppLaunchPlan | null;
|
|
16
|
+
error?: string;
|
|
17
|
+
};
|
|
18
|
+
'launch:will-start': LaunchEventIdentity & {
|
|
19
|
+
plan: AppLaunchPlan;
|
|
20
|
+
};
|
|
21
|
+
'launch:started': LaunchEventIdentity & {
|
|
22
|
+
pid?: string;
|
|
23
|
+
executionId?: string;
|
|
24
|
+
};
|
|
25
|
+
'launch:output': LaunchEventIdentity & {
|
|
26
|
+
stream: 'stdout' | 'stderr' | 'system';
|
|
27
|
+
content: string;
|
|
28
|
+
formatted: string;
|
|
29
|
+
};
|
|
30
|
+
'launch:ready': LaunchEventIdentity & {
|
|
31
|
+
webUrl?: string;
|
|
32
|
+
};
|
|
33
|
+
'launch:stopped': LaunchEventIdentity & {
|
|
34
|
+
reason?: 'user' | 'process-exited' | 'cancelled';
|
|
35
|
+
};
|
|
36
|
+
'launch:failed': LaunchEventIdentity & {
|
|
37
|
+
error: string;
|
|
38
|
+
stopReason?: string;
|
|
39
|
+
};
|
|
40
|
+
'install:started': {
|
|
41
|
+
appId?: string;
|
|
42
|
+
sessionId: string;
|
|
43
|
+
};
|
|
44
|
+
'install:step-progress': {
|
|
45
|
+
appId?: string;
|
|
46
|
+
sessionId: string;
|
|
47
|
+
stepId: string;
|
|
48
|
+
progress?: number;
|
|
49
|
+
message?: string;
|
|
50
|
+
};
|
|
51
|
+
'install:completed': {
|
|
52
|
+
appId?: string;
|
|
53
|
+
sessionId: string;
|
|
54
|
+
};
|
|
55
|
+
'install:failed': {
|
|
56
|
+
appId?: string;
|
|
57
|
+
sessionId: string;
|
|
58
|
+
error: string;
|
|
59
|
+
};
|
|
60
|
+
'install:cancelled': {
|
|
61
|
+
appId?: string;
|
|
62
|
+
sessionId: string;
|
|
63
|
+
reason?: string;
|
|
64
|
+
};
|
|
65
|
+
'download:started': {
|
|
66
|
+
appId?: string;
|
|
67
|
+
downloadId: string;
|
|
68
|
+
};
|
|
69
|
+
'download:progress': {
|
|
70
|
+
appId?: string;
|
|
71
|
+
downloadId: string;
|
|
72
|
+
progress: number;
|
|
73
|
+
};
|
|
74
|
+
'download:paused': {
|
|
75
|
+
appId?: string;
|
|
76
|
+
downloadId: string;
|
|
77
|
+
};
|
|
78
|
+
'download:completed': {
|
|
79
|
+
appId?: string;
|
|
80
|
+
downloadId: string;
|
|
81
|
+
};
|
|
82
|
+
'download:failed': {
|
|
83
|
+
appId?: string;
|
|
84
|
+
downloadId: string;
|
|
85
|
+
error: string;
|
|
86
|
+
};
|
|
87
|
+
'app:registered': {
|
|
88
|
+
appId: string;
|
|
89
|
+
pluginId: string;
|
|
90
|
+
};
|
|
91
|
+
'app:unregistered': {
|
|
92
|
+
appId: string;
|
|
93
|
+
pluginId: string;
|
|
94
|
+
};
|
|
95
|
+
'app:params-changed': {
|
|
96
|
+
appId: string;
|
|
97
|
+
pluginId: string;
|
|
98
|
+
params: Record<string, unknown>;
|
|
99
|
+
};
|
|
100
|
+
'extension:installed': {
|
|
101
|
+
appId: string;
|
|
102
|
+
extensionId: string;
|
|
103
|
+
};
|
|
104
|
+
'extension:uninstalled': {
|
|
105
|
+
appId: string;
|
|
106
|
+
extensionId: string;
|
|
107
|
+
};
|
|
108
|
+
'extension:updated': {
|
|
109
|
+
appId: string;
|
|
110
|
+
extensionId: string;
|
|
111
|
+
};
|
|
112
|
+
'extension:toggled': {
|
|
113
|
+
appId: string;
|
|
114
|
+
extensionId: string;
|
|
115
|
+
enabled: boolean;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
export type AppLifecycleEventName = keyof AppLifecycleEventMap;
|
|
119
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { PluginCommand, PluginUiSlot, PluginPage, PluginWorkspaceTab, PluginAppAction } from '../api/contributions';
|
|
2
|
+
import type { PluginLaunchParticipant } from './launch-pipeline';
|
|
3
|
+
import type { InstallRecipe } from './install-recipe';
|
|
4
|
+
import type { DropHandlerRegistration } from './drop';
|
|
5
|
+
import type { PluginApi } from '../api/types';
|
|
6
|
+
import type { AppInstance } from './app-context';
|
|
7
|
+
import type { ModelMarketProvider } from './model-market';
|
|
8
|
+
import type { ExtensionMarketProvider, ExtensionProvider, LaunchProvider, ModelProvider, PythonCandidate, VersionProvider } from './providers';
|
|
9
|
+
export interface PluginIdentifier {
|
|
10
|
+
type: 'file' | 'folder' | 'git-remote' | 'package-json' | 'requirements';
|
|
11
|
+
pattern: string;
|
|
12
|
+
weight?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface WebViewConfig {
|
|
15
|
+
urlTemplate: string;
|
|
16
|
+
defaultPort: number;
|
|
17
|
+
portParamId?: string;
|
|
18
|
+
autoOpen?: boolean;
|
|
19
|
+
/** Return a URL only when application output explicitly announces a ready WebUI. */
|
|
20
|
+
getReadyUrlFromLog?(content: string, params: Record<string, unknown>): string | null;
|
|
21
|
+
}
|
|
22
|
+
export interface AppImportDiscovery {
|
|
23
|
+
suggestedName?: string;
|
|
24
|
+
pythonPath?: string;
|
|
25
|
+
nodePath?: string;
|
|
26
|
+
binaryPath?: string;
|
|
27
|
+
initialParams?: Record<string, unknown>;
|
|
28
|
+
initialEnv?: Record<string, string>;
|
|
29
|
+
}
|
|
30
|
+
export interface AppPythonConfig {
|
|
31
|
+
candidates?: PythonCandidate[] | ((appPath: string) => PythonCandidate[]);
|
|
32
|
+
minVersion?: string;
|
|
33
|
+
maxVersion?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface PluginAppContribution {
|
|
36
|
+
/** A returned cleanup runs when the update completes, fails, or pauses for confirmation. */
|
|
37
|
+
beforeUpdate?(api: PluginApi, app: AppInstance, automaticSnapshot: boolean): Promise<void | (() => void)>;
|
|
38
|
+
icon?: string;
|
|
39
|
+
color?: string;
|
|
40
|
+
identifiers?: PluginIdentifier[];
|
|
41
|
+
webview?: WebViewConfig;
|
|
42
|
+
tabs?: PluginWorkspaceTab[];
|
|
43
|
+
actions?: PluginAppAction[];
|
|
44
|
+
python?: AppPythonConfig;
|
|
45
|
+
discoverImport?(path: string, api: PluginApi): Promise<AppImportDiscovery | null>;
|
|
46
|
+
onInstalled?(context: {
|
|
47
|
+
app: AppInstance;
|
|
48
|
+
mode: 'install' | 'apply' | 'import';
|
|
49
|
+
api: PluginApi;
|
|
50
|
+
}): void | Promise<void>;
|
|
51
|
+
/** A positive probe adds one match point, including when no declarative identifier matches. */
|
|
52
|
+
detect?(path: string, api: PluginApi): Promise<boolean>;
|
|
53
|
+
launchProvider?: LaunchProvider;
|
|
54
|
+
modelProvider?: ModelProvider;
|
|
55
|
+
versionProvider?: VersionProvider;
|
|
56
|
+
extensionProvider?: ExtensionProvider;
|
|
57
|
+
extensionMarketProvider?: ExtensionMarketProvider;
|
|
58
|
+
}
|
|
59
|
+
export interface DefinedPlugin {
|
|
60
|
+
id: string;
|
|
61
|
+
/** Global catalogs; independent of an app contribution. */
|
|
62
|
+
modelMarkets?: ModelMarketProvider[];
|
|
63
|
+
recipes?: InstallRecipe[];
|
|
64
|
+
commands?: PluginCommand[];
|
|
65
|
+
pages?: PluginPage[];
|
|
66
|
+
slots?: PluginUiSlot[];
|
|
67
|
+
launchParticipants?: PluginLaunchParticipant[];
|
|
68
|
+
drops?: DropHandlerRegistration[];
|
|
69
|
+
app?: PluginAppContribution;
|
|
70
|
+
activate?(api: PluginApi): void | Promise<void>;
|
|
71
|
+
deactivate?(): void | Promise<void>;
|
|
72
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Component } from 'vue';
|
|
2
|
+
import type { PluginApi, PluginSubscriptionToken } from '../api/types';
|
|
3
|
+
import type { AppInstance } from './app-context';
|
|
4
|
+
/** Files are local browser Files, even when the selected app runs on an SSH server. */
|
|
5
|
+
export interface DropPayload {
|
|
6
|
+
files: File[];
|
|
7
|
+
text: string;
|
|
8
|
+
types: string[];
|
|
9
|
+
app: AppInstance | null;
|
|
10
|
+
}
|
|
11
|
+
export interface DropPreview {
|
|
12
|
+
title: string;
|
|
13
|
+
maximizable?: boolean;
|
|
14
|
+
component: Component;
|
|
15
|
+
props?: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
export interface DropHandlerRegistration {
|
|
18
|
+
id: string;
|
|
19
|
+
label: string;
|
|
20
|
+
/** App handlers run only in this plugin's selected workspace, before window handlers. */
|
|
21
|
+
scope: 'app' | 'window';
|
|
22
|
+
accept: {
|
|
23
|
+
/** Case insensitive extensions, including the leading dot. All files must match. */
|
|
24
|
+
extensions?: string[];
|
|
25
|
+
/** Exact MIME types, or text/plain / text/uri-list for text drops. */
|
|
26
|
+
mimeTypes?: string[];
|
|
27
|
+
};
|
|
28
|
+
/** Optional synchronous refinement, called only after the drop data is readable. */
|
|
29
|
+
matches?(payload: DropPayload, api: PluginApi): boolean;
|
|
30
|
+
handle(payload: DropPayload, api: PluginApi): void | DropPreview | Promise<void | DropPreview>;
|
|
31
|
+
}
|
|
32
|
+
export interface PluginDropsApi {
|
|
33
|
+
/** Automatically removed on plugin deactivation, including any open preview. */
|
|
34
|
+
register(handler: DropHandlerRegistration): PluginSubscriptionToken;
|
|
35
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { BinaryInstalledVersion } from './providers';
|
|
2
|
+
export type MarketItemKind = 'app' | 'bundle';
|
|
3
|
+
export interface InstallVariable {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
type: 'string' | 'select';
|
|
7
|
+
default?: string;
|
|
8
|
+
defaultWhen?: {
|
|
9
|
+
when: RecipeCondition;
|
|
10
|
+
value: string;
|
|
11
|
+
}[];
|
|
12
|
+
options?: {
|
|
13
|
+
label: string;
|
|
14
|
+
value: string;
|
|
15
|
+
when?: RecipeCondition;
|
|
16
|
+
}[];
|
|
17
|
+
required?: boolean;
|
|
18
|
+
description?: string;
|
|
19
|
+
}
|
|
20
|
+
export type RecipeCondition = {
|
|
21
|
+
os: string[];
|
|
22
|
+
} | {
|
|
23
|
+
arch: string[];
|
|
24
|
+
} | {
|
|
25
|
+
gpuVendor: string[];
|
|
26
|
+
} | {
|
|
27
|
+
varEquals: {
|
|
28
|
+
var: string;
|
|
29
|
+
value: string;
|
|
30
|
+
};
|
|
31
|
+
} | {
|
|
32
|
+
and: RecipeCondition[];
|
|
33
|
+
} | {
|
|
34
|
+
or: RecipeCondition[];
|
|
35
|
+
} | {
|
|
36
|
+
not: RecipeCondition;
|
|
37
|
+
};
|
|
38
|
+
type Step<T extends string, P> = {
|
|
39
|
+
type: T;
|
|
40
|
+
label: string;
|
|
41
|
+
params: P;
|
|
42
|
+
};
|
|
43
|
+
export type RecipeOperation = Step<'node.ensureRuntime', {
|
|
44
|
+
version: string;
|
|
45
|
+
url: string;
|
|
46
|
+
sha256: string;
|
|
47
|
+
format: 'zip' | 'tar.gz';
|
|
48
|
+
strip_components?: number;
|
|
49
|
+
}> | Step<'npm.install', {
|
|
50
|
+
app_path: string;
|
|
51
|
+
node_version?: string;
|
|
52
|
+
node_path?: string;
|
|
53
|
+
packages: string[];
|
|
54
|
+
registry?: string;
|
|
55
|
+
}> | Step<'download', {
|
|
56
|
+
url: string;
|
|
57
|
+
path: string;
|
|
58
|
+
sha256: string;
|
|
59
|
+
}> | Step<'archive.extract', {
|
|
60
|
+
path: string;
|
|
61
|
+
destination: string;
|
|
62
|
+
format: 'zip' | 'tar.gz';
|
|
63
|
+
strip_components?: number;
|
|
64
|
+
merge?: boolean;
|
|
65
|
+
if_missing?: boolean;
|
|
66
|
+
}> | Step<'git.clone', {
|
|
67
|
+
url: string;
|
|
68
|
+
path: string;
|
|
69
|
+
branch?: string;
|
|
70
|
+
depth?: number;
|
|
71
|
+
recurse_submodules?: boolean;
|
|
72
|
+
if_missing?: boolean;
|
|
73
|
+
}> | Step<'git.checkout', {
|
|
74
|
+
path: string;
|
|
75
|
+
ref: string;
|
|
76
|
+
fetch?: boolean;
|
|
77
|
+
}> | Step<'python.verify', {
|
|
78
|
+
python_path: string;
|
|
79
|
+
version: string;
|
|
80
|
+
}> | Step<'python.ensureEnvironment', {
|
|
81
|
+
app_path: string;
|
|
82
|
+
version: string;
|
|
83
|
+
backend?: string;
|
|
84
|
+
source?: string;
|
|
85
|
+
index?: string;
|
|
86
|
+
}> | Step<'python.createVenv', {
|
|
87
|
+
python_path: string;
|
|
88
|
+
venv_path: string;
|
|
89
|
+
if_missing?: boolean;
|
|
90
|
+
}> | Step<'pip.install', {
|
|
91
|
+
python_path: string;
|
|
92
|
+
packages: string[];
|
|
93
|
+
index?: string;
|
|
94
|
+
extra_args?: string[];
|
|
95
|
+
}> | Step<'pip.installRequirements', {
|
|
96
|
+
python_path: string;
|
|
97
|
+
requirements_path: string;
|
|
98
|
+
index?: string;
|
|
99
|
+
constraints_path?: string;
|
|
100
|
+
constraints?: string[];
|
|
101
|
+
}>;
|
|
102
|
+
export type RecipeStep = (RecipeOperation & {
|
|
103
|
+
when?: RecipeCondition;
|
|
104
|
+
}) | {
|
|
105
|
+
type: 'group';
|
|
106
|
+
label: string;
|
|
107
|
+
when?: RecipeCondition;
|
|
108
|
+
steps: RecipeStep[];
|
|
109
|
+
};
|
|
110
|
+
export interface RecipeWorkflow {
|
|
111
|
+
steps: RecipeStep[];
|
|
112
|
+
result: {
|
|
113
|
+
pythonPath?: string;
|
|
114
|
+
nodeVersion?: string;
|
|
115
|
+
params?: Record<string, unknown>;
|
|
116
|
+
env?: Record<string, string>;
|
|
117
|
+
binaryVersion?: BinaryInstalledVersion;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
export interface InstallRecipe {
|
|
121
|
+
schemaVersion: 1;
|
|
122
|
+
id: string;
|
|
123
|
+
version: string;
|
|
124
|
+
kind: MarketItemKind;
|
|
125
|
+
name: string;
|
|
126
|
+
pluginId: string;
|
|
127
|
+
platforms: {
|
|
128
|
+
os: string;
|
|
129
|
+
arch: string;
|
|
130
|
+
minVersion?: string;
|
|
131
|
+
}[];
|
|
132
|
+
variables?: InstallVariable[];
|
|
133
|
+
install?: RecipeWorkflow;
|
|
134
|
+
apply?: RecipeWorkflow & {
|
|
135
|
+
target: {
|
|
136
|
+
gitRemote?: string;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
export {};
|