@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,150 @@
|
|
|
1
|
+
import type { LaunchBackendKind, LaunchCapabilityFeatureSet, LaunchGpuVendor } from './launch-pipeline';
|
|
2
|
+
import type { FeatureDetector, LaunchRuleContext } from './launch';
|
|
3
|
+
export interface VersionConstraint {
|
|
4
|
+
minCommit?: string;
|
|
5
|
+
maxCommit?: string;
|
|
6
|
+
minTag?: string;
|
|
7
|
+
maxTag?: string;
|
|
8
|
+
branches?: string[];
|
|
9
|
+
}
|
|
10
|
+
export type ParamAvailability = {
|
|
11
|
+
feature: FeatureDetector;
|
|
12
|
+
} | {
|
|
13
|
+
forks: string[];
|
|
14
|
+
} | {
|
|
15
|
+
version: VersionConstraint;
|
|
16
|
+
} | {
|
|
17
|
+
minVersion: string;
|
|
18
|
+
} | {
|
|
19
|
+
maxVersion: string;
|
|
20
|
+
} | {
|
|
21
|
+
minCommit: string;
|
|
22
|
+
} | {
|
|
23
|
+
maxCommit: string;
|
|
24
|
+
} | {
|
|
25
|
+
os: ('windows' | 'linux' | 'macos')[];
|
|
26
|
+
} | {
|
|
27
|
+
gpuVendor: LaunchGpuVendor[];
|
|
28
|
+
} | {
|
|
29
|
+
backend: LaunchBackendKind[];
|
|
30
|
+
} | {
|
|
31
|
+
minMemoryMB: number;
|
|
32
|
+
} | {
|
|
33
|
+
backendFeature: keyof LaunchCapabilityFeatureSet;
|
|
34
|
+
} | {
|
|
35
|
+
and: ParamAvailability[];
|
|
36
|
+
} | {
|
|
37
|
+
or: ParamAvailability[];
|
|
38
|
+
} | {
|
|
39
|
+
not: ParamAvailability;
|
|
40
|
+
} | ((ctx: LaunchRuleContext) => boolean | Promise<boolean>);
|
|
41
|
+
export type ParamType = 'boolean' | 'string' | 'number' | 'select' | 'path' | 'text' | 'port';
|
|
42
|
+
export interface ParamOption {
|
|
43
|
+
label: string;
|
|
44
|
+
value: string | number | boolean;
|
|
45
|
+
description?: string;
|
|
46
|
+
available?: ParamAvailability;
|
|
47
|
+
audience?: ParamAudience;
|
|
48
|
+
cli?: string | CliArgument | CliArgument[];
|
|
49
|
+
}
|
|
50
|
+
export type ParamCondition = {
|
|
51
|
+
param: string;
|
|
52
|
+
equals: unknown;
|
|
53
|
+
} | {
|
|
54
|
+
param: string;
|
|
55
|
+
notEquals: unknown;
|
|
56
|
+
} | {
|
|
57
|
+
param: string;
|
|
58
|
+
in: unknown[];
|
|
59
|
+
} | {
|
|
60
|
+
param: string;
|
|
61
|
+
truthy: boolean;
|
|
62
|
+
} | {
|
|
63
|
+
param: string;
|
|
64
|
+
set: boolean;
|
|
65
|
+
} | {
|
|
66
|
+
and: ParamCondition[];
|
|
67
|
+
} | {
|
|
68
|
+
or: ParamCondition[];
|
|
69
|
+
} | {
|
|
70
|
+
not: ParamCondition;
|
|
71
|
+
};
|
|
72
|
+
export type ParamEmitWhen = 'always' | 'truthy' | 'changed' | 'set';
|
|
73
|
+
export type CliValue = {
|
|
74
|
+
param: string;
|
|
75
|
+
optional?: boolean;
|
|
76
|
+
} | {
|
|
77
|
+
literal: string | number | boolean;
|
|
78
|
+
};
|
|
79
|
+
export interface CliArgument {
|
|
80
|
+
arg: string;
|
|
81
|
+
format?: 'flag' | 'value' | 'equals' | 'values' | 'repeat';
|
|
82
|
+
when?: ParamEmitWhen;
|
|
83
|
+
/** Values are separate argv entries; omitted uses this parameter's value. */
|
|
84
|
+
values?: CliValue[];
|
|
85
|
+
split?: 'lines' | 'whitespace' | 'comma';
|
|
86
|
+
join?: string;
|
|
87
|
+
resolvePath?: boolean;
|
|
88
|
+
falseArg?: string;
|
|
89
|
+
}
|
|
90
|
+
export type CliMapping = string | CliArgument | CliArgument[] | ((value: unknown, ctx: LaunchRuleContext) => string[]);
|
|
91
|
+
export interface ParamRule {
|
|
92
|
+
id: string;
|
|
93
|
+
/** A true condition reports this issue. */
|
|
94
|
+
when: ParamCondition;
|
|
95
|
+
message: string;
|
|
96
|
+
severity?: 'error' | 'warning';
|
|
97
|
+
params: string[];
|
|
98
|
+
}
|
|
99
|
+
export type EnvMapping = string | {
|
|
100
|
+
name: string;
|
|
101
|
+
format?: 'value' | 'boolean' | 'path';
|
|
102
|
+
when?: ParamEmitWhen;
|
|
103
|
+
transform?: (value: unknown, ctx: LaunchRuleContext) => string;
|
|
104
|
+
} | ((value: unknown, ctx: LaunchRuleContext) => Record<string, string>);
|
|
105
|
+
export interface ParamGroup {
|
|
106
|
+
id: string;
|
|
107
|
+
label: string;
|
|
108
|
+
icon?: string;
|
|
109
|
+
description?: string;
|
|
110
|
+
order?: number;
|
|
111
|
+
collapsed?: boolean;
|
|
112
|
+
}
|
|
113
|
+
export type ParamAudience = 'basic' | 'advanced' | 'expert';
|
|
114
|
+
export interface ParamDefinition {
|
|
115
|
+
id: string;
|
|
116
|
+
label: string;
|
|
117
|
+
description?: string;
|
|
118
|
+
type: ParamType;
|
|
119
|
+
/** Path inputs default to directories. File filters use extensions without a dot. */
|
|
120
|
+
pathKind?: 'file' | 'directory';
|
|
121
|
+
fileFilters?: {
|
|
122
|
+
name: string;
|
|
123
|
+
extensions: string[];
|
|
124
|
+
}[];
|
|
125
|
+
options?: ParamOption[];
|
|
126
|
+
min?: number;
|
|
127
|
+
max?: number;
|
|
128
|
+
step?: number;
|
|
129
|
+
/** Enforce whole numbers; step only controls the input increment. */
|
|
130
|
+
integer?: boolean;
|
|
131
|
+
/** Allow an empty numeric, select or boolean value instead of requiring a value. */
|
|
132
|
+
optional?: boolean;
|
|
133
|
+
placeholder?: string;
|
|
134
|
+
default?: unknown;
|
|
135
|
+
defaultFn?: (ctx: LaunchRuleContext) => unknown;
|
|
136
|
+
group?: string;
|
|
137
|
+
order?: number;
|
|
138
|
+
audience?: ParamAudience;
|
|
139
|
+
showWhen?: ParamCondition;
|
|
140
|
+
available?: ParamAvailability;
|
|
141
|
+
cli?: CliMapping;
|
|
142
|
+
/** Extra owned flags for a custom CLI callback. Declarative outputs are inferred. */
|
|
143
|
+
ownedArgs?: string[];
|
|
144
|
+
env?: EnvMapping;
|
|
145
|
+
required?: boolean;
|
|
146
|
+
validate?: (value: unknown, ctx: LaunchRuleContext) => string | null;
|
|
147
|
+
docsUrl?: string;
|
|
148
|
+
warning?: string;
|
|
149
|
+
deprecated?: string;
|
|
150
|
+
}
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import type { PluginApi } from '../api/types';
|
|
2
|
+
import type { AppContext, AppInstance } from './app-context';
|
|
3
|
+
import type { GitInfo, LaunchEntry, LaunchPreset, LaunchRuleContext } from './launch';
|
|
4
|
+
import type { LaunchFacts, LaunchStrategy } from './launch-pipeline';
|
|
5
|
+
import type { CliArgument, ParamDefinition, ParamGroup, ParamRule } from './params';
|
|
6
|
+
/** Python apps default to an optional requirements.txt in the application directory. */
|
|
7
|
+
export interface PythonDependencySpec {
|
|
8
|
+
files?: Array<{
|
|
9
|
+
path: string;
|
|
10
|
+
optional?: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
/** Requirements in each enabled immediate child; paths are relative to the application. */
|
|
13
|
+
directories?: Array<{
|
|
14
|
+
path: string;
|
|
15
|
+
requirements?: string;
|
|
16
|
+
exclude?: string[];
|
|
17
|
+
disabled_suffix?: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export interface LaunchProvider {
|
|
21
|
+
/** Application settings outside launch presets, preserved when applying or resetting a preset. */
|
|
22
|
+
persistentParams?: string[];
|
|
23
|
+
entry: LaunchEntry;
|
|
24
|
+
dependencies?: PythonDependencySpec | false | ((facts: LaunchFacts) => PythonDependencySpec | false);
|
|
25
|
+
groups?: ParamGroup[];
|
|
26
|
+
params?: ParamDefinition[];
|
|
27
|
+
presets?: LaunchPreset[];
|
|
28
|
+
/** Overrides applied to the detached planning input for a single start. */
|
|
29
|
+
startOptions?: {
|
|
30
|
+
id: string;
|
|
31
|
+
label: string;
|
|
32
|
+
params: Record<string, unknown>;
|
|
33
|
+
}[];
|
|
34
|
+
rules?: ParamRule[];
|
|
35
|
+
ownedArgs?: string[];
|
|
36
|
+
extraArgs?: {
|
|
37
|
+
param: string;
|
|
38
|
+
target: 'argv' | {
|
|
39
|
+
env: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
resolveParams?(ctx: LaunchRuleContext): Record<string, unknown>;
|
|
43
|
+
bindings?(ctx: LaunchRuleContext): {
|
|
44
|
+
args?: CliArgument[];
|
|
45
|
+
env?: Record<string, string>;
|
|
46
|
+
};
|
|
47
|
+
getWebViewUrl?(params: Record<string, unknown>): string;
|
|
48
|
+
detectFork?(repo: GitInfo): string | undefined;
|
|
49
|
+
strategy?: LaunchStrategy;
|
|
50
|
+
}
|
|
51
|
+
export interface ModelInfo {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
fileName: string;
|
|
55
|
+
categoryId: string;
|
|
56
|
+
path: string;
|
|
57
|
+
fullPath: string;
|
|
58
|
+
size: number;
|
|
59
|
+
sizeFormatted: string;
|
|
60
|
+
createdAt?: string;
|
|
61
|
+
modifiedAt?: string;
|
|
62
|
+
metadata?: Record<string, unknown>;
|
|
63
|
+
thumbnail?: string;
|
|
64
|
+
}
|
|
65
|
+
export type ModelAction = 'open-folder' | 'delete' | 'rename' | 'move' | 'copy' | 'show-info';
|
|
66
|
+
export interface ModelActionDefinition {
|
|
67
|
+
id: ModelAction | string;
|
|
68
|
+
label: string;
|
|
69
|
+
icon: string;
|
|
70
|
+
danger?: boolean;
|
|
71
|
+
confirm?: boolean;
|
|
72
|
+
confirmMessage?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface ModelCategoryDef {
|
|
75
|
+
/** Additional absolute scan directories on the same executor. Downloads use paths. */
|
|
76
|
+
sharedPaths?: string[];
|
|
77
|
+
/** Execution-server base for relative category paths; defaults to the registered application path. */
|
|
78
|
+
basePath?: string;
|
|
79
|
+
/** Model market types accepted by this directory. Omitted categories are not download targets. */
|
|
80
|
+
marketTypes?: import('./model-market').ModelType[];
|
|
81
|
+
id: string;
|
|
82
|
+
label: string;
|
|
83
|
+
icon?: string;
|
|
84
|
+
paths: string[];
|
|
85
|
+
extensions: string[];
|
|
86
|
+
description?: string;
|
|
87
|
+
}
|
|
88
|
+
export interface ModelProvider {
|
|
89
|
+
resolveCategoryLocation?(app: Pick<AppContext, 'path' | 'params'>, category: ModelCategoryDef): Pick<ModelCategoryDef, 'paths' | 'basePath' | 'sharedPaths'>;
|
|
90
|
+
/** Model path and companion launch parameters committed together when the user selects a model. */
|
|
91
|
+
launchModel?: {
|
|
92
|
+
pathParam: string;
|
|
93
|
+
params?: Record<string, unknown>;
|
|
94
|
+
};
|
|
95
|
+
categories?: ModelCategoryDef[];
|
|
96
|
+
getActions?(): ModelActionDefinition[];
|
|
97
|
+
executeAction?(ctx: AppContext, model: ModelInfo, action: string, api: PluginApi): Promise<void>;
|
|
98
|
+
}
|
|
99
|
+
export interface PresetVersion {
|
|
100
|
+
id: string;
|
|
101
|
+
label: string;
|
|
102
|
+
description?: string;
|
|
103
|
+
branch?: string;
|
|
104
|
+
tag?: string;
|
|
105
|
+
commit?: string;
|
|
106
|
+
recommended?: boolean;
|
|
107
|
+
badge?: string;
|
|
108
|
+
badgeType?: 'primary' | 'success' | 'warning' | 'danger';
|
|
109
|
+
}
|
|
110
|
+
export interface VersionPreset {
|
|
111
|
+
id: string;
|
|
112
|
+
name: string;
|
|
113
|
+
description?: string;
|
|
114
|
+
branch: string;
|
|
115
|
+
commit?: string;
|
|
116
|
+
isRecommended?: boolean;
|
|
117
|
+
}
|
|
118
|
+
export interface RecommendedRemote {
|
|
119
|
+
id: string;
|
|
120
|
+
name: string;
|
|
121
|
+
url: string;
|
|
122
|
+
description?: string;
|
|
123
|
+
isDefault?: boolean;
|
|
124
|
+
}
|
|
125
|
+
export interface GitVersionProvider {
|
|
126
|
+
kind: 'git';
|
|
127
|
+
presets?: VersionPreset[];
|
|
128
|
+
recommendedRemotes?: RecommendedRemote[];
|
|
129
|
+
defaultBranch?: string;
|
|
130
|
+
getRecommendedVersion?(): {
|
|
131
|
+
branch?: string;
|
|
132
|
+
tag?: string;
|
|
133
|
+
};
|
|
134
|
+
getRepository?(): string;
|
|
135
|
+
getPresetVersions?(): PresetVersion[];
|
|
136
|
+
getChangelogUrl?(): string;
|
|
137
|
+
}
|
|
138
|
+
/** Declarative, prebuilt releases; no Git checkout or Python environment is needed. */
|
|
139
|
+
export type BinaryVersionProvider = {
|
|
140
|
+
kind: 'binary';
|
|
141
|
+
executableParam: string;
|
|
142
|
+
defaultExecutable?: string;
|
|
143
|
+
} & ({
|
|
144
|
+
source: {
|
|
145
|
+
type: 'github';
|
|
146
|
+
repository: string;
|
|
147
|
+
};
|
|
148
|
+
variants: BinaryVariant[];
|
|
149
|
+
} | {
|
|
150
|
+
source: CustomBinarySource;
|
|
151
|
+
variants: BinaryTarget[];
|
|
152
|
+
});
|
|
153
|
+
export interface BinaryTarget {
|
|
154
|
+
id: string;
|
|
155
|
+
label: string;
|
|
156
|
+
os: string;
|
|
157
|
+
arch: string;
|
|
158
|
+
}
|
|
159
|
+
export interface CustomBinarySource {
|
|
160
|
+
type: 'custom';
|
|
161
|
+
/** Return up to 30 releases per page, or only the requested exact version. */
|
|
162
|
+
listReleases(query: {
|
|
163
|
+
page: number;
|
|
164
|
+
version?: string;
|
|
165
|
+
}, api: PluginApi): Promise<BinaryRelease[]>;
|
|
166
|
+
resolveInstallPlan(input: {
|
|
167
|
+
app: AppInstance;
|
|
168
|
+
release: BinaryRelease;
|
|
169
|
+
variant: BinaryTarget;
|
|
170
|
+
}, api: PluginApi): Promise<BinaryInstallFiles>;
|
|
171
|
+
}
|
|
172
|
+
export interface BinaryInstallFiles {
|
|
173
|
+
/** Relative to the extracted release directory. */
|
|
174
|
+
executable: string;
|
|
175
|
+
archives: {
|
|
176
|
+
name: string;
|
|
177
|
+
url: string;
|
|
178
|
+
sha256: string;
|
|
179
|
+
format: 'zip' | 'tar.gz';
|
|
180
|
+
stripComponents?: number;
|
|
181
|
+
}[];
|
|
182
|
+
}
|
|
183
|
+
export interface BinaryVariant extends BinaryTarget {
|
|
184
|
+
/** Relative path inside the extracted release directory. */
|
|
185
|
+
executable: string;
|
|
186
|
+
archives: Array<{
|
|
187
|
+
/** Exact release asset name; {version} expands to the release tag. */
|
|
188
|
+
name: string;
|
|
189
|
+
format: 'zip' | 'tar.gz';
|
|
190
|
+
stripComponents?: number;
|
|
191
|
+
}>;
|
|
192
|
+
}
|
|
193
|
+
export interface BinaryRelease {
|
|
194
|
+
version: string;
|
|
195
|
+
label: string;
|
|
196
|
+
url: string;
|
|
197
|
+
prerelease: boolean;
|
|
198
|
+
assets: Array<{
|
|
199
|
+
name: string;
|
|
200
|
+
url: string;
|
|
201
|
+
sha256: string;
|
|
202
|
+
size: number;
|
|
203
|
+
}>;
|
|
204
|
+
}
|
|
205
|
+
export interface BinaryInstalledVersion {
|
|
206
|
+
version: string;
|
|
207
|
+
variant: string;
|
|
208
|
+
executable: string;
|
|
209
|
+
executableParam: string;
|
|
210
|
+
source: string;
|
|
211
|
+
}
|
|
212
|
+
/** An application-local npm package, installed with the application's selected Node. */
|
|
213
|
+
export interface NpmVersionProvider {
|
|
214
|
+
kind: 'npm';
|
|
215
|
+
packageName: string;
|
|
216
|
+
registry?: string;
|
|
217
|
+
}
|
|
218
|
+
export interface NpmRelease {
|
|
219
|
+
version: string;
|
|
220
|
+
tags: string[];
|
|
221
|
+
nodeEngine?: string;
|
|
222
|
+
deprecated?: string;
|
|
223
|
+
}
|
|
224
|
+
export interface NpmInstalledVersion {
|
|
225
|
+
packageName: string;
|
|
226
|
+
version: string;
|
|
227
|
+
registry: string;
|
|
228
|
+
}
|
|
229
|
+
export interface NpmPackageState extends NpmInstalledVersion {
|
|
230
|
+
managed: boolean;
|
|
231
|
+
recordedVersion?: string;
|
|
232
|
+
}
|
|
233
|
+
export type VersionProvider = GitVersionProvider | BinaryVersionProvider | NpmVersionProvider;
|
|
234
|
+
export interface PythonCandidate {
|
|
235
|
+
path: string;
|
|
236
|
+
label?: string;
|
|
237
|
+
priority?: number;
|
|
238
|
+
isVenv?: boolean;
|
|
239
|
+
}
|
|
240
|
+
export interface PythonDetectResult {
|
|
241
|
+
path: string;
|
|
242
|
+
version: string;
|
|
243
|
+
isVenv: boolean;
|
|
244
|
+
source: string;
|
|
245
|
+
meetsRequirements: boolean;
|
|
246
|
+
}
|
|
247
|
+
export interface ExtensionInfo {
|
|
248
|
+
id: string;
|
|
249
|
+
name: string;
|
|
250
|
+
description?: string;
|
|
251
|
+
path: string;
|
|
252
|
+
relativePath: string;
|
|
253
|
+
isGitRepo: boolean;
|
|
254
|
+
gitRemoteUrl?: string;
|
|
255
|
+
gitBranch?: string;
|
|
256
|
+
gitCommit?: string;
|
|
257
|
+
gitCommitShort?: string;
|
|
258
|
+
hasUpdates?: boolean;
|
|
259
|
+
version?: string;
|
|
260
|
+
author?: string;
|
|
261
|
+
homepage?: string;
|
|
262
|
+
tags?: string[];
|
|
263
|
+
enabled: boolean;
|
|
264
|
+
lastUpdated?: string;
|
|
265
|
+
}
|
|
266
|
+
export type ExtensionToggleResult = Partial<ExtensionInfo>;
|
|
267
|
+
export interface ExtensionResetImpactFile {
|
|
268
|
+
path: string;
|
|
269
|
+
staging: string;
|
|
270
|
+
worktree: string;
|
|
271
|
+
reason: string;
|
|
272
|
+
}
|
|
273
|
+
export interface ExtensionUpdateResult {
|
|
274
|
+
updated: boolean;
|
|
275
|
+
requiresConfirmation: boolean;
|
|
276
|
+
impactFiles: ExtensionResetImpactFile[];
|
|
277
|
+
localCommit: string;
|
|
278
|
+
remoteCommit: string;
|
|
279
|
+
branch: string;
|
|
280
|
+
remoteName: string;
|
|
281
|
+
}
|
|
282
|
+
export interface ExtensionCheckUpdatesProgress {
|
|
283
|
+
extensionId?: string;
|
|
284
|
+
checked: number;
|
|
285
|
+
total: number;
|
|
286
|
+
hasUpdates?: boolean;
|
|
287
|
+
error?: unknown;
|
|
288
|
+
}
|
|
289
|
+
export interface ExtensionCheckUpdatesOptions {
|
|
290
|
+
onProgress?: (progress: ExtensionCheckUpdatesProgress) => void;
|
|
291
|
+
}
|
|
292
|
+
export interface ExtensionMarketItem {
|
|
293
|
+
id: string;
|
|
294
|
+
name: string;
|
|
295
|
+
description: string;
|
|
296
|
+
gitUrl: string;
|
|
297
|
+
author?: string;
|
|
298
|
+
stars?: number;
|
|
299
|
+
tags?: string[];
|
|
300
|
+
homepage?: string;
|
|
301
|
+
thumbnail?: string;
|
|
302
|
+
installed?: boolean;
|
|
303
|
+
branch?: string;
|
|
304
|
+
}
|
|
305
|
+
export interface ExtensionMarketSource {
|
|
306
|
+
id: string;
|
|
307
|
+
name: string;
|
|
308
|
+
url: string;
|
|
309
|
+
description?: string;
|
|
310
|
+
type?: 'json' | 'csv' | 'custom';
|
|
311
|
+
transform?: (data: unknown) => unknown[];
|
|
312
|
+
}
|
|
313
|
+
export interface ExtensionConfig {
|
|
314
|
+
directory: string;
|
|
315
|
+
supportsToggle: boolean;
|
|
316
|
+
ignoreDirs?: string[];
|
|
317
|
+
}
|
|
318
|
+
export interface ExtensionProvider {
|
|
319
|
+
resolveBasePath?(app: AppContext, api: PluginApi): string;
|
|
320
|
+
parseLoadReport?(logs: readonly string[], api: PluginApi): {
|
|
321
|
+
loaded: number;
|
|
322
|
+
failures: {
|
|
323
|
+
name: string;
|
|
324
|
+
path: string;
|
|
325
|
+
reason: string;
|
|
326
|
+
}[];
|
|
327
|
+
} | null;
|
|
328
|
+
getConfig?(api: PluginApi): ExtensionConfig;
|
|
329
|
+
scanExtensions?(ctx: AppContext, api: PluginApi): Promise<ExtensionInfo[]>;
|
|
330
|
+
installExtension?(ctx: AppContext, gitUrl: string, branch: string | undefined, api: PluginApi): Promise<ExtensionInfo>;
|
|
331
|
+
updateExtension?(ctx: AppContext, extensionId: string, options: {
|
|
332
|
+
allowDirty?: boolean;
|
|
333
|
+
} | undefined, api: PluginApi): Promise<ExtensionUpdateResult | void>;
|
|
334
|
+
uninstallExtension?(ctx: AppContext, extensionId: string, api: PluginApi): Promise<void>;
|
|
335
|
+
toggleExtension?(ctx: AppContext, extensionId: string, enabled: boolean, api: PluginApi): Promise<ExtensionToggleResult | void>;
|
|
336
|
+
getMarketplace?(ctx: AppContext, api: PluginApi): Promise<ExtensionMarketItem[]>;
|
|
337
|
+
checkUpdates?(ctx: AppContext, extensionIds: string[] | undefined, options: ExtensionCheckUpdatesOptions | undefined, api: PluginApi): Promise<Map<string, boolean>>;
|
|
338
|
+
onInstalled?(ctx: AppContext, extension: ExtensionInfo, api: PluginApi): Promise<void>;
|
|
339
|
+
onUpdated?(ctx: AppContext, extension: ExtensionInfo, api: PluginApi): Promise<void>;
|
|
340
|
+
}
|
|
341
|
+
export interface ExtensionMarketProvider {
|
|
342
|
+
sources: ExtensionMarketSource[];
|
|
343
|
+
transform?: (data: unknown) => unknown[];
|
|
344
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { PluginSubscriptionToken } from '../api/types';
|
|
2
|
+
import type { AppStatus } from './app-context';
|
|
3
|
+
export interface SessionEvent {
|
|
4
|
+
type: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SessionEventSubscriptionOptions {
|
|
7
|
+
replay?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface SessionEventStream<TEvent extends SessionEvent> {
|
|
10
|
+
on(handler: (event: TEvent) => void, options?: SessionEventSubscriptionOptions): PluginSubscriptionToken;
|
|
11
|
+
off(token: PluginSubscriptionToken): void;
|
|
12
|
+
snapshot(): readonly TEvent[];
|
|
13
|
+
}
|
|
14
|
+
export interface SessionHandle<TState, TEvent extends SessionEvent> {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
getState(): TState;
|
|
17
|
+
readonly events: SessionEventStream<TEvent>;
|
|
18
|
+
}
|
|
19
|
+
export type LaunchSessionStatus = AppStatus;
|
|
20
|
+
export type LaunchSubPhase = 'idle' | 'planning' | 'preparing-env' | 'preflight' | 'spawning' | 'probing-ready' | 'ready' | 'readiness-failed' | 'stopping';
|
|
21
|
+
export interface LaunchSessionState {
|
|
22
|
+
phase: LaunchSubPhase;
|
|
23
|
+
runId?: string;
|
|
24
|
+
submitted: boolean;
|
|
25
|
+
needsRestart?: boolean;
|
|
26
|
+
readinessError?: string;
|
|
27
|
+
status: LaunchSessionStatus;
|
|
28
|
+
processId?: string;
|
|
29
|
+
executionId?: string;
|
|
30
|
+
logs: string[];
|
|
31
|
+
error?: string;
|
|
32
|
+
startedAt?: string;
|
|
33
|
+
webUrl?: string;
|
|
34
|
+
}
|
|
35
|
+
export type LaunchSessionEvent = {
|
|
36
|
+
type: 'phase';
|
|
37
|
+
phase: LaunchSubPhase;
|
|
38
|
+
previousPhase: LaunchSubPhase;
|
|
39
|
+
} | {
|
|
40
|
+
type: 'status';
|
|
41
|
+
status: LaunchSessionStatus;
|
|
42
|
+
previousStatus: LaunchSessionStatus;
|
|
43
|
+
processId?: string;
|
|
44
|
+
executionId?: string;
|
|
45
|
+
} | {
|
|
46
|
+
type: 'error';
|
|
47
|
+
error: string;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'web-url';
|
|
50
|
+
webUrl?: string;
|
|
51
|
+
} | {
|
|
52
|
+
type: 'log';
|
|
53
|
+
log: string;
|
|
54
|
+
} | {
|
|
55
|
+
type: 'logs-cleared';
|
|
56
|
+
} | {
|
|
57
|
+
type: 'reset';
|
|
58
|
+
};
|
|
59
|
+
export interface PluginLaunchSessionsApi {
|
|
60
|
+
get(appId: string): SessionHandle<LaunchSessionState, LaunchSessionEvent> | null;
|
|
61
|
+
}
|
|
62
|
+
export interface PluginSessionsApi {
|
|
63
|
+
launch: PluginLaunchSessionsApi;
|
|
64
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LaunchRuleContext } from '../contracts/launch';
|
|
2
|
+
import type { ParamCondition, ParamDefinition } from '../contracts/params';
|
|
3
|
+
import type { LaunchProvider } from '../contracts/providers';
|
|
4
|
+
export declare function isParamSet(value: unknown): boolean;
|
|
5
|
+
export declare function evaluateParamCondition(condition: ParamCondition | undefined, params: Record<string, unknown>): boolean;
|
|
6
|
+
export declare function getManagedCliFlags(provider: Pick<LaunchProvider, 'params' | 'ownedArgs'>): string[];
|
|
7
|
+
export declare function validateParamValue(param: ParamDefinition, value: unknown, ctx?: LaunchRuleContext): string | null;
|
|
8
|
+
export interface ParamIssue {
|
|
9
|
+
id: string;
|
|
10
|
+
params: string[];
|
|
11
|
+
severity: 'error' | 'warning';
|
|
12
|
+
message: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function validateParamRules(provider: Pick<LaunchProvider, 'rules'>, params: Record<string, unknown>): ParamIssue[];
|