@sigma-file-manager/api 1.3.0 → 1.4.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 CHANGED
@@ -39,6 +39,4 @@ Use this schema URL in your extension `package.json`:
39
39
 
40
40
  ## Release
41
41
 
42
- - Package versions are independent from app versions.
43
- - Use `api-vX.Y.Z` tags for package releases.
44
- - Publish from `packages/api` with `npm publish`.
42
+ API package versions are independent from app versions and tagged as `api-vX.Y.Z`.
package/index.d.ts CHANGED
@@ -13,7 +13,9 @@ export type ExtensionPermission
13
13
  | 'fs.write'
14
14
  | 'notifications'
15
15
  | 'dialogs'
16
- | 'shell';
16
+ | 'shell'
17
+ | 'clipboard'
18
+ | 'openUrl';
17
19
 
18
20
  export type ExtensionActivationEvent
19
21
  = | 'onStartup'
@@ -22,6 +24,7 @@ export type ExtensionActivationEvent
22
24
  | 'onEnable'
23
25
  | 'onDisable'
24
26
  | 'onUpdate'
27
+ | 'onLocaleChange'
25
28
  | `onCommand:${string}`;
26
29
 
27
30
  export interface ExtensionPublisher {
@@ -125,7 +128,26 @@ export interface ExtensionEngines {
125
128
  }
126
129
 
127
130
  export type PlatformOS = 'windows' | 'macos' | 'linux';
128
- export type PlatformArch = 'x64' | 'arm64' | 'x86';
131
+ export type PlatformArch = 'x64' | 'arm64';
132
+
133
+ export interface ManifestBinaryAsset {
134
+ platform: PlatformOS;
135
+ arch?: PlatformArch[];
136
+ downloadUrl: string;
137
+ integrity: string;
138
+ archive?: boolean;
139
+ executable?: string;
140
+ }
141
+
142
+ export interface ManifestBinaryDefinition {
143
+ id: string;
144
+ name: string;
145
+ version: string;
146
+ executable?: string;
147
+ repository?: string;
148
+ platforms?: PlatformOS[];
149
+ assets: ManifestBinaryAsset[];
150
+ }
129
151
 
130
152
  export interface ExtensionManifest {
131
153
  id: string;
@@ -145,6 +167,7 @@ export interface ExtensionManifest {
145
167
  activationEvents?: ExtensionActivationEvent[];
146
168
  contributes?: ExtensionContributions;
147
169
  platforms?: PlatformOS[];
170
+ binaries?: ManifestBinaryDefinition[];
148
171
  engines: ExtensionEngines;
149
172
  }
150
173
 
@@ -258,21 +281,13 @@ export interface SaveFileDialogOptions {
258
281
  filters?: FileDialogFilter[];
259
282
  }
260
283
 
261
- export interface BinaryInstallOptions {
262
- name: string;
263
- downloadUrl: string | ((platform: PlatformOS) => string);
264
- integrity?: string;
265
- executable?: string;
266
- version?: string;
267
- repository?: string;
268
- }
269
-
270
284
  export interface BinaryInfo {
271
285
  id: string;
272
286
  path: string;
273
287
  version?: string;
274
288
  storageVersion?: string | null;
275
289
  repository?: string;
290
+ downloadUrl?: string;
276
291
  latestVersion?: string;
277
292
  hasUpdate?: boolean;
278
293
  latestCheckedAt?: number;
@@ -339,6 +354,7 @@ export interface ModalHandle {
339
354
  close(): void;
340
355
  updateElement(id: string, updates: Partial<UIElement>): void;
341
356
  setContent(content: UIElement[]): void;
357
+ setButtons(buttons: ModalButton[]): void;
342
358
  getValues(): Record<string, unknown>;
343
359
  }
344
360
 
@@ -348,7 +364,7 @@ export interface ToolbarRenderHandle {
348
364
 
349
365
  export interface PlatformInfo {
350
366
  os: PlatformOS;
351
- arch: PlatformArch;
367
+ arch: string;
352
368
  pathSeparator: string;
353
369
  isWindows: boolean;
354
370
  isMacos: boolean;
@@ -360,7 +376,7 @@ export interface SigmaExtensionAPI {
360
376
  t(key: string, params?: Record<string, string | number>): string;
361
377
  mergeMessages(messages: Record<string, Record<string, string>>): void;
362
378
  mergeFromPath(basePath: string): Promise<void>;
363
- extensionT(key: string, params?: Record<string, string | number>): string;
379
+ extensionT(key: string, params?: Record<string, string | number>, fallback?: string): string;
364
380
  };
365
381
  contextMenu: {
366
382
  registerItem(
@@ -437,11 +453,20 @@ export interface SigmaExtensionAPI {
437
453
  ui: {
438
454
  showNotification(options: NotificationOptions): void;
439
455
  showDialog(options: DialogOptions): Promise<DialogResult>;
456
+ copyText(text: string): Promise<void>;
457
+ /**
458
+ * Writes data to the clipboard. Supported MIME types: `image/png`, `text/html`, `text/plain`.
459
+ * When `text/html` is provided alongside `text/plain`, the plain text is used as fallback.
460
+ * Writes the first supported representation found across items (image/png > text/html > text/plain).
461
+ * Throws if only unsupported types are provided.
462
+ */
463
+ clipboardWrite(items: Record<string, Uint8Array>[]): Promise<void>;
440
464
  withProgress<T>(
441
465
  options: ProgressOptions,
442
466
  task: (progress: Progress, token: CancellationToken) => Promise<T>
443
467
  ): Promise<T>;
444
468
  createModal(options: ModalOptions): ModalHandle;
469
+ showModal(options: ModalOptions): Promise<Record<string, unknown> | null>;
445
470
  input(options: {
446
471
  id: string;
447
472
  label?: string;
@@ -553,18 +578,24 @@ export interface SigmaExtensionAPI {
553
578
  };
554
579
  platform: {
555
580
  readonly os: PlatformOS;
556
- readonly arch: PlatformArch;
581
+ readonly arch: string;
557
582
  readonly pathSeparator: string;
558
583
  readonly isWindows: boolean;
559
584
  readonly isMacos: boolean;
560
585
  readonly isLinux: boolean;
561
586
  joinPath(...segments: string[]): string;
562
587
  };
588
+ path: {
589
+ dirname(filePath: string): string;
590
+ basename(filePath: string, suffix?: string): string;
591
+ extname(filePath: string): string;
592
+ };
593
+ runtime: {
594
+ isExtensionInstallCancelledError(error: unknown): boolean;
595
+ };
563
596
  binary: {
564
- ensureInstalled(id: string, options: BinaryInstallOptions): Promise<string>;
565
597
  getPath(id: string): Promise<string | null>;
566
598
  isInstalled(id: string): Promise<boolean>;
567
- remove(id: string): Promise<void>;
568
599
  getInfo(id: string): Promise<BinaryInfo | null>;
569
600
  };
570
601
  }
@@ -129,7 +129,9 @@
129
129
  "fs.write",
130
130
  "notifications",
131
131
  "dialogs",
132
- "shell"
132
+ "shell",
133
+ "clipboard",
134
+ "openUrl"
133
135
  ]
134
136
  }
135
137
  },
@@ -146,7 +148,8 @@
146
148
  "onUninstall",
147
149
  "onEnable",
148
150
  "onDisable",
149
- "onUpdate"
151
+ "onUpdate",
152
+ "onLocaleChange"
150
153
  ]
151
154
  },
152
155
  {
@@ -168,11 +171,21 @@
168
171
  "title"
169
172
  ],
170
173
  "properties": {
171
- "id": { "type": "string" },
172
- "title": { "type": "string" },
173
- "description": { "type": "string" },
174
- "icon": { "type": "string" },
175
- "shortcut": { "type": "string" }
174
+ "id": {
175
+ "type": "string"
176
+ },
177
+ "title": {
178
+ "type": "string"
179
+ },
180
+ "description": {
181
+ "type": "string"
182
+ },
183
+ "icon": {
184
+ "type": "string"
185
+ },
186
+ "shortcut": {
187
+ "type": "string"
188
+ }
176
189
  }
177
190
  }
178
191
  },
@@ -185,11 +198,21 @@
185
198
  "title"
186
199
  ],
187
200
  "properties": {
188
- "id": { "type": "string" },
189
- "title": { "type": "string" },
190
- "icon": { "type": "string" },
191
- "group": { "type": "string" },
192
- "order": { "type": "number" },
201
+ "id": {
202
+ "type": "string"
203
+ },
204
+ "title": {
205
+ "type": "string"
206
+ },
207
+ "icon": {
208
+ "type": "string"
209
+ },
210
+ "group": {
211
+ "type": "string"
212
+ },
213
+ "order": {
214
+ "type": "number"
215
+ },
193
216
  "when": {
194
217
  "type": "object",
195
218
  "properties": {
@@ -230,10 +253,18 @@
230
253
  "icon"
231
254
  ],
232
255
  "properties": {
233
- "id": { "type": "string" },
234
- "title": { "type": "string" },
235
- "icon": { "type": "string" },
236
- "order": { "type": "number" },
256
+ "id": {
257
+ "type": "string"
258
+ },
259
+ "title": {
260
+ "type": "string"
261
+ },
262
+ "icon": {
263
+ "type": "string"
264
+ },
265
+ "order": {
266
+ "type": "number"
267
+ },
237
268
  "url": {
238
269
  "type": "string",
239
270
  "format": "uri"
@@ -251,9 +282,15 @@
251
282
  "items"
252
283
  ],
253
284
  "properties": {
254
- "id": { "type": "string" },
255
- "title": { "type": "string" },
256
- "icon": { "type": "string" },
285
+ "id": {
286
+ "type": "string"
287
+ },
288
+ "title": {
289
+ "type": "string"
290
+ },
291
+ "icon": {
292
+ "type": "string"
293
+ },
257
294
  "items": {
258
295
  "type": "array",
259
296
  "items": {
@@ -263,11 +300,21 @@
263
300
  "title"
264
301
  ],
265
302
  "properties": {
266
- "id": { "type": "string" },
267
- "title": { "type": "string" },
268
- "icon": { "type": "string" },
269
- "commandId": { "type": "string" },
270
- "separator": { "type": "boolean" }
303
+ "id": {
304
+ "type": "string"
305
+ },
306
+ "title": {
307
+ "type": "string"
308
+ },
309
+ "icon": {
310
+ "type": "string"
311
+ },
312
+ "commandId": {
313
+ "type": "string"
314
+ },
315
+ "separator": {
316
+ "type": "boolean"
317
+ }
271
318
  }
272
319
  }
273
320
  }
@@ -357,8 +404,12 @@
357
404
  "key"
358
405
  ],
359
406
  "properties": {
360
- "command": { "type": "string" },
361
- "key": { "type": "string" },
407
+ "command": {
408
+ "type": "string"
409
+ },
410
+ "key": {
411
+ "type": "string"
412
+ },
362
413
  "when": {
363
414
  "type": "string",
364
415
  "enum": [
@@ -389,6 +440,104 @@
389
440
  "minItems": 1,
390
441
  "uniqueItems": true
391
442
  },
443
+ "binaries": {
444
+ "type": "array",
445
+ "description": "Binary definitions installed and managed by the host application",
446
+ "items": {
447
+ "type": "object",
448
+ "required": [
449
+ "id",
450
+ "name",
451
+ "version",
452
+ "assets"
453
+ ],
454
+ "properties": {
455
+ "id": {
456
+ "type": "string",
457
+ "description": "Unique binary identifier shared across extensions"
458
+ },
459
+ "name": {
460
+ "type": "string",
461
+ "description": "Display name of the binary"
462
+ },
463
+ "version": {
464
+ "type": "string",
465
+ "description": "Pinned binary version used for shared lookup and install",
466
+ "minLength": 1
467
+ },
468
+ "executable": {
469
+ "type": "string",
470
+ "description": "Relative path to the executable inside the extracted directory"
471
+ },
472
+ "repository": {
473
+ "type": "string",
474
+ "format": "uri",
475
+ "description": "Upstream repository URL for reference"
476
+ },
477
+ "platforms": {
478
+ "type": "array",
479
+ "items": {
480
+ "type": "string",
481
+ "enum": [
482
+ "windows",
483
+ "macos",
484
+ "linux"
485
+ ]
486
+ },
487
+ "minItems": 1,
488
+ "uniqueItems": true
489
+ },
490
+ "assets": {
491
+ "type": "array",
492
+ "minItems": 1,
493
+ "items": {
494
+ "type": "object",
495
+ "required": [
496
+ "platform",
497
+ "downloadUrl",
498
+ "integrity"
499
+ ],
500
+ "properties": {
501
+ "platform": {
502
+ "type": "string",
503
+ "enum": [
504
+ "windows",
505
+ "macos",
506
+ "linux"
507
+ ]
508
+ },
509
+ "arch": {
510
+ "type": "array",
511
+ "items": {
512
+ "type": "string",
513
+ "enum": [
514
+ "x64",
515
+ "arm64"
516
+ ]
517
+ },
518
+ "minItems": 1,
519
+ "uniqueItems": true
520
+ },
521
+ "downloadUrl": {
522
+ "type": "string",
523
+ "format": "uri"
524
+ },
525
+ "integrity": {
526
+ "type": "string",
527
+ "pattern": "^sha256:[a-fA-F0-9]{64}$"
528
+ },
529
+ "archive": {
530
+ "type": "boolean"
531
+ },
532
+ "executable": {
533
+ "type": "string"
534
+ }
535
+ }
536
+ }
537
+ }
538
+ }
539
+ }
540
+ },
392
541
  "engines": {
393
542
  "type": "object",
394
543
  "description": "Version constraints",
@@ -403,4 +552,4 @@
403
552
  }
404
553
  }
405
554
  }
406
- }
555
+ }
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
- {
2
- "name": "@sigma-file-manager/api",
3
- "version": "1.3.0",
4
- "description": "Type definitions and manifest schema for Sigma File Manager extensions",
5
- "license": "GPL-3.0-or-later",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/aleksey-hoffman/sigma-file-manager.git",
9
- "directory": "packages/api"
10
- },
11
- "files": [
12
- "index.d.ts",
13
- "manifest.schema.json",
14
- "README.md"
15
- ],
16
- "types": "index.d.ts",
17
- "publishConfig": {
18
- "access": "public"
19
- }
20
- }
1
+ {
2
+ "name": "@sigma-file-manager/api",
3
+ "version": "1.4.0",
4
+ "description": "Type definitions and manifest schema for Sigma File Manager extensions",
5
+ "license": "GPL-3.0-or-later",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/aleksey-hoffman/sigma-file-manager.git",
9
+ "directory": "packages/api"
10
+ },
11
+ "files": [
12
+ "index.d.ts",
13
+ "manifest.schema.json",
14
+ "README.md"
15
+ ],
16
+ "types": "index.d.ts",
17
+ "publishConfig": {
18
+ "access": "public"
19
+ }
20
+ }