@punica/editor 1.0.6 → 1.0.7

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.
Files changed (69) hide show
  1. package/dist/index.bundle.esm.js +1 -1
  2. package/dist/index.bundle.esm.js.map +1 -1
  3. package/dist/index.bundle.umd.js +1 -1
  4. package/dist/index.bundle.umd.js.map +1 -1
  5. package/package.json +28 -3
  6. package/types/index.d.ts +120 -11
  7. package/types/punica.module.bootstrap.d.ts +45 -0
  8. package/types/punica.module.capability.d.ts +359 -0
  9. package/types/punica.module.extensions.api.d.ts +740 -0
  10. package/types/punica.module.extensions.settings.d.ts +106 -0
  11. package/types/punica.module.flow.agent.d.ts +75 -0
  12. package/types/punica.module.flow.api.d.ts +128 -0
  13. package/types/punica.module.flow.d.ts +490 -0
  14. package/types/punica.module.flow.engine.d.ts +228 -0
  15. package/types/punica.module.flow.mcp.d.ts +26 -0
  16. package/types/punica.module.flow.notebook.d.ts +210 -0
  17. package/types/punica.module.flow.primitives.d.ts +700 -0
  18. package/types/punica.module.flow.shell.d.ts +374 -0
  19. package/types/punica.module.kernel.ai.d.ts +462 -0
  20. package/types/punica.module.kernel.commands.d.ts +49 -0
  21. package/types/punica.module.kernel.events.d.ts +274 -0
  22. package/types/punica.module.kernel.history.d.ts +20 -0
  23. package/types/punica.module.kernel.llm.d.ts +343 -0
  24. package/types/punica.module.kernel.notifications.d.ts +64 -0
  25. package/types/punica.module.kernel.policy.d.ts +273 -0
  26. package/types/punica.module.kernel.tasks.d.ts +107 -0
  27. package/types/punica.module.kernel.timeServer.d.ts +16 -0
  28. package/types/punica.module.runtime.api.d.ts +214 -0
  29. package/types/punica.module.runtime.capabilities.d.ts +175 -0
  30. package/types/punica.module.runtime.compute.d.ts +339 -0
  31. package/types/punica.module.runtime.datasets.d.ts +234 -0
  32. package/types/punica.module.runtime.fs.d.ts +385 -0
  33. package/types/punica.module.runtime.harness.d.ts +246 -0
  34. package/types/punica.module.runtime.host.d.ts +272 -0
  35. package/types/punica.module.runtime.inference.d.ts +164 -0
  36. package/types/punica.module.runtime.lifecycle.d.ts +15 -0
  37. package/types/punica.module.runtime.llm.d.ts +470 -0
  38. package/types/punica.module.runtime.mcp.d.ts +139 -0
  39. package/types/punica.module.runtime.modelRuntimes.d.ts +90 -0
  40. package/types/punica.module.runtime.models.d.ts +254 -0
  41. package/types/punica.module.runtime.search.d.ts +59 -0
  42. package/types/punica.module.runtime.secrets.d.ts +26 -0
  43. package/types/punica.module.runtime.tasks.d.ts +27 -0
  44. package/types/punica.module.runtime.vcs.d.ts +67 -0
  45. package/types/punica.module.runtime.vectors.d.ts +74 -0
  46. package/types/punica.module.runtime.workspace.d.ts +134 -0
  47. package/types/punica.module.shell.activityBar.d.ts +42 -0
  48. package/types/punica.module.shell.components.d.ts +87 -0
  49. package/types/punica.module.shell.contentTabs.d.ts +33 -0
  50. package/types/punica.module.shell.dragDrop.d.ts +25 -0
  51. package/types/punica.module.shell.keyboardShortcuts.d.ts +38 -0
  52. package/types/punica.module.shell.layout.d.ts +106 -0
  53. package/types/punica.module.shell.markdown.d.ts +36 -0
  54. package/types/punica.module.shell.panelTabs.d.ts +48 -0
  55. package/types/punica.module.shell.profile.d.ts +278 -0
  56. package/types/punica.module.shell.statusbar.d.ts +26 -0
  57. package/types/punica.module.shell.view.d.ts +455 -0
  58. package/types/punica.module.shell.views.d.ts +150 -0
  59. package/types/punica.module.test.d.ts +562 -0
  60. package/types/punica.module.activityBar.d.ts +0 -21
  61. package/types/punica.module.commands.d.ts +0 -21
  62. package/types/punica.module.dragDrop.d.ts +0 -23
  63. package/types/punica.module.extensions.d.ts +0 -157
  64. package/types/punica.module.history.d.ts +0 -18
  65. package/types/punica.module.keyboardShortcuts.d.ts +0 -29
  66. package/types/punica.module.layout.d.ts +0 -22
  67. package/types/punica.module.statusbar.d.ts +0 -21
  68. package/types/punica.module.timeServer.d.ts +0 -14
  69. package/types/punica.module.view.d.ts +0 -8
@@ -0,0 +1,234 @@
1
+ declare module 'punica' {
2
+ export namespace runtime {
3
+ export namespace datasets {
4
+ /**
5
+ * Dataset provider identifier (e.g., "kaggle", "huggingface", "local", "s3").
6
+ */
7
+ export type DatasetProviderId = string;
8
+
9
+ /**
10
+ * Reference to a dataset in a specific provider.
11
+ */
12
+ export interface DatasetRef {
13
+ /**
14
+ * Provider identifier (e.g., "kaggle", "huggingface", "local", "s3").
15
+ */
16
+ provider: DatasetProviderId;
17
+ /**
18
+ * Dataset identifier within the provider (dataset slug, path, URI, etc.).
19
+ */
20
+ id: string;
21
+ /**
22
+ * Optional revision/version identifier.
23
+ * - HuggingFace: git SHA/tag
24
+ * - S3: versionId
25
+ * - Kaggle: version
26
+ * - Local: hash
27
+ */
28
+ revision?: string;
29
+ /**
30
+ * Optional format hint for the dataset.
31
+ */
32
+ format?: 'files' | 'table' | 'parquet' | 'image' | 'audio' | 'video';
33
+ }
34
+
35
+ /**
36
+ * Metadata about a dataset.
37
+ */
38
+ export interface DatasetMetadata {
39
+ /**
40
+ * Reference to the dataset.
41
+ */
42
+ ref: DatasetRef;
43
+ /**
44
+ * Human-readable name.
45
+ */
46
+ name: string;
47
+ /**
48
+ * Optional description.
49
+ */
50
+ description?: string;
51
+ /**
52
+ * Optional tags for categorization.
53
+ */
54
+ tags?: string[];
55
+ /**
56
+ * Optional license information.
57
+ */
58
+ license?: string;
59
+ /**
60
+ * Optional statistics about the dataset.
61
+ */
62
+ stats?: {
63
+ bytes?: number;
64
+ files?: number;
65
+ rows?: number;
66
+ columns?: number;
67
+ };
68
+ /**
69
+ * Optional schema information.
70
+ */
71
+ schema?: {
72
+ kind: 'table' | 'files';
73
+ columns?: Array<{
74
+ name: string;
75
+ dtype: string;
76
+ nullable?: boolean;
77
+ }>;
78
+ };
79
+ }
80
+
81
+ /**
82
+ * A mounted dataset that is accessible via a canonical URI.
83
+ */
84
+ export interface MountedDataset {
85
+ /**
86
+ * Reference to the dataset.
87
+ */
88
+ ref: DatasetRef;
89
+ /**
90
+ * Canonical URI for accessing the dataset in compute contexts.
91
+ * Format: "punica://dataset/{provider}/{id}"
92
+ */
93
+ uri: string;
94
+ /**
95
+ * Whether the dataset is mounted as read-only.
96
+ */
97
+ readOnly: boolean;
98
+ /**
99
+ * Optional expiration timestamp (ISO 8601).
100
+ */
101
+ expiresAt?: string;
102
+ }
103
+
104
+ /**
105
+ * Options for mounting a dataset.
106
+ */
107
+ export interface MountOptions {
108
+ /**
109
+ * Whether to mount as read-only (default: true).
110
+ */
111
+ readOnly?: boolean;
112
+ }
113
+
114
+ /**
115
+ * Options for listing datasets.
116
+ */
117
+ export interface ListOptions {
118
+ /**
119
+ * Optional search query.
120
+ */
121
+ query?: string;
122
+ /**
123
+ * Optional tags to filter by.
124
+ */
125
+ tags?: string[];
126
+ }
127
+
128
+ /**
129
+ * Dataset provider interface (implemented by extensions).
130
+ */
131
+ export interface DatasetProvider {
132
+ /**
133
+ * Unique provider identifier.
134
+ */
135
+ id: DatasetProviderId;
136
+ /**
137
+ * Resolve dataset metadata from a reference.
138
+ */
139
+ resolve(ref: DatasetRef): Promise<DatasetMetadata>;
140
+ /**
141
+ * Mount a dataset and return a canonical URI for access.
142
+ */
143
+ mount(ref: DatasetRef, opts?: MountOptions): Promise<MountedDataset>;
144
+ /**
145
+ * Unmount a dataset by URI.
146
+ */
147
+ unmount(uri: string): Promise<void>;
148
+ /**
149
+ * List available datasets from this provider.
150
+ */
151
+ list(opts?: ListOptions): Promise<DatasetMetadata[]>;
152
+ }
153
+
154
+ /**
155
+ * Registry for dataset providers.
156
+ */
157
+ export interface DatasetRegistry {
158
+ /**
159
+ * Register a dataset provider.
160
+ */
161
+ registerProvider(provider: DatasetProvider): void;
162
+ /**
163
+ * Get a provider by ID.
164
+ */
165
+ getProvider(id: DatasetProviderId): DatasetProvider | undefined;
166
+ /**
167
+ * List all registered providers.
168
+ */
169
+ listProviders(): DatasetProvider[];
170
+ }
171
+
172
+ /**
173
+ * Main datasets API surface.
174
+ */
175
+ export interface DatasetsApi {
176
+ /**
177
+ * Resolve dataset metadata from a reference.
178
+ */
179
+ resolve(ref: DatasetRef): Promise<DatasetMetadata>;
180
+ /**
181
+ * Mount a dataset and return a canonical URI for access.
182
+ */
183
+ mount(ref: DatasetRef, opts?: MountOptions): Promise<MountedDataset>;
184
+ /**
185
+ * Unmount a dataset by URI.
186
+ */
187
+ unmount(uri: string): Promise<void>;
188
+ /**
189
+ * List available datasets.
190
+ * If provider is specified, only lists from that provider.
191
+ * Otherwise, aggregates results from all providers.
192
+ */
193
+ list(opts?: {
194
+ provider?: DatasetProviderId;
195
+ query?: string;
196
+ tags?: string[];
197
+ }): Promise<DatasetMetadata[]>;
198
+ /**
199
+ * Registry for providers.
200
+ */
201
+ registry: DatasetRegistry;
202
+ }
203
+
204
+ /**
205
+ * Local storage format for workspace datasets.
206
+ * Used by LocalDatasetProvider for .punica/datasets.json
207
+ */
208
+ export interface LocalDatasetRecord {
209
+ id: string;
210
+ platform: string;
211
+ name: string;
212
+ identifier: string;
213
+ description?: string | null;
214
+ owner?: string | null;
215
+ size?: string | null;
216
+ fileTypes?: string[] | null;
217
+ url?: string | null;
218
+ filePaths?: string[] | null;
219
+ metadata?: any;
220
+ status?: string | null;
221
+ createdAt?: string | null;
222
+ updatedAt?: string | null;
223
+ }
224
+
225
+ /**
226
+ * Index file format for local datasets storage.
227
+ */
228
+ export interface LocalDatasetsIndexFile {
229
+ version?: number;
230
+ datasets?: LocalDatasetRecord[];
231
+ }
232
+ }
233
+ }
234
+ }
@@ -0,0 +1,385 @@
1
+ declare module 'punica' {
2
+ export namespace runtime {
3
+ interface FileEntry {
4
+ path: string;
5
+ name: string;
6
+ isDirectory: boolean;
7
+ children?: FileEntry[];
8
+ }
9
+
10
+ /**
11
+ * Provider capability surface flags for `FileSystemProvider`. A
12
+ * provider advertises which features it supports; the substrate
13
+ * uses this set to decide what it can dispatch through a given
14
+ * provider (and to reject requests that require a feature the
15
+ * provider has not declared).
16
+ *
17
+ * - 'streaming' : opt-in chunked read/write for large files
18
+ * - 'watch' : path-scoped change notifications
19
+ * - 'versioning' : per-path history + time-travel reads
20
+ * - 'encrypted-at-rest' : payloads stored encrypted by the host
21
+ * - 'snapshot' : whole-tree point-in-time copies
22
+ */
23
+ export type FileSystemProviderCapability =
24
+ | 'streaming'
25
+ | 'watch'
26
+ | 'versioning'
27
+ | 'encrypted-at-rest'
28
+ | 'snapshot';
29
+
30
+ /**
31
+ * Data classification used by the capability gateway's encryption
32
+ * routing. Sensitive payloads are only dispatched through a
33
+ * provider that advertises the `'encrypted-at-rest'` capability;
34
+ * if none is registered, the call is rejected at the gateway. The
35
+ * substrate never holds encryption keys — key management is host
36
+ * territory.
37
+ */
38
+ export type EncryptionRequirement = 'public' | 'internal' | 'sensitive';
39
+
40
+ /**
41
+ * Per-path metadata returned by `FileSystemProvider.stat`. All
42
+ * timestamps are milliseconds since epoch. `mode` follows the
43
+ * POSIX rwx triplet convention but is provider-defined and may
44
+ * be `undefined` on backends that do not expose it (HTTP,
45
+ * IndexedDB). `isSymlink` is provider-defined; in-memory and
46
+ * HTTP/Kubernetes shapes typically leave it false.
47
+ */
48
+ export interface FileStat {
49
+ size: number;
50
+ mtimeMs: number;
51
+ ctimeMs: number;
52
+ mode?: number;
53
+ isDirectory: boolean;
54
+ isSymlink: boolean;
55
+ }
56
+
57
+ /**
58
+ * Path-scoped change notification surfaced by an optional
59
+ * `FileSystemProvider.watch` subscription. Discriminated by
60
+ * `kind`; the `previousPath` payload only appears on `renamed`.
61
+ */
62
+ export type WatchEvent =
63
+ | { kind: 'created'; path: string; isDirectory: boolean }
64
+ | { kind: 'modified'; path: string }
65
+ | { kind: 'deleted'; path: string }
66
+ | { kind: 'renamed'; path: string; previousPath: string };
67
+
68
+ /**
69
+ * Snapshot of an in-flight `fs.migrate` run. Substrate ships
70
+ * this shape + the state machine; persistent storage of progress
71
+ * is host territory.
72
+ */
73
+ export interface FsMigrationProgress {
74
+ migrationId: string;
75
+ sourceProviderId: string;
76
+ targetProviderId: string;
77
+ position: number;
78
+ transferred: number;
79
+ remaining: number;
80
+ lastError?: string;
81
+ terminal: boolean;
82
+ pendingResume: boolean;
83
+ }
84
+
85
+ /**
86
+ * Metadata for a snapshot produced by `fs.snapshot`. The actual
87
+ * bytes are persisted by the host (substrate concern is the
88
+ * sozlesme + state machine, not storage).
89
+ */
90
+ export interface FsSnapshotMeta {
91
+ snapshotId: string;
92
+ providerId: string;
93
+ scope?: string;
94
+ createdAtMs: number;
95
+ bytes?: number;
96
+ }
97
+
98
+ /**
99
+ * Optional flags accepted by `FileSystemProvider.deleteFile`. The
100
+ * legacy FS contract was "missing file throws"; with
101
+ * `ifExists: true` callers can request idempotent delete without
102
+ * a wrapping try/catch. Other fields remain provider-defined.
103
+ */
104
+ export interface FileDeleteOptions {
105
+ ifExists?: boolean;
106
+ }
107
+
108
+ /**
109
+ * Optional flags accepted by `FileSystemProvider.mkdir`. Mirrors
110
+ * POSIX `mkdir -p`; when `recursive` is omitted the contract is
111
+ * provider-defined (in-memory + HTTP/Kubernetes shapes default
112
+ * to non-recursive create).
113
+ */
114
+ export interface MkdirOptions {
115
+ recursive?: boolean;
116
+ }
117
+
118
+ /**
119
+ * Optional flags accepted by `FileSystemProvider.list`. `recursive`
120
+ * walks descendants; the default is direct-children only.
121
+ * Substrate returns a flat array of `FileEntry` so callers can
122
+ * paginate on top — no nested `children` arrays in `list`
123
+ * responses (unlike `getFileTree`).
124
+ */
125
+ export interface ListOptions {
126
+ recursive?: boolean;
127
+ }
128
+
129
+ /**
130
+ * Per-version metadata returned by `FileSystemProvider.history`.
131
+ * One entry per write at a path; the substrate uses these to
132
+ * surface "what's in my history" timelines and to drive
133
+ * `readAtVersion(path, versionId)` time-travel reads.
134
+ *
135
+ * Content bytes are NOT carried here — the substrate keeps
136
+ * `history()` cheap so a thousand-version log fits in one
137
+ * response. Callers fetch content via `readAtVersion`.
138
+ */
139
+ export interface FileVersion {
140
+ /** Opaque, monotonic-per-path identifier. */
141
+ versionId: string;
142
+ /** Wall-clock timestamp this version was written. */
143
+ mtimeMs: number;
144
+ /** Content size in bytes (UTF-8 length proxy). */
145
+ sizeBytes: number;
146
+ /** Content hash at write time (FNV-1a 32-bit hex). */
147
+ hash: string;
148
+ }
149
+
150
+ /**
151
+ * Abstraction over the host filesystem / workspace. Implemented by the host
152
+ * (Electron, browser + HTTP, etc.) and exposed to extensions via
153
+ * `punica.Runtime.fs` (and thus `window.punica.Runtime.fs` in the browser).
154
+ */
155
+ /**
156
+ * Filesystem capability: basic file and folder operations for the current workspace.
157
+ *
158
+ * The interface grew along two axes during data plane / FS providers:
159
+ * - the original 9 methods stayed required (existing hosts keep
160
+ * working without changes);
161
+ * - a `capabilities` set + optional methods (stat / exists /
162
+ * copy / mkdir / chmod / symlink / watch) were added so hosts
163
+ * can incrementally adopt richer surfaces while the substrate
164
+ * gates dispatch based on declared capabilities.
165
+ *
166
+ * `cwd` is the workspace-root path that all relative paths are
167
+ * resolved against. The substrate canonicalizes against this root
168
+ * inside the path-traversal middleware (path-traversal guard); providers
169
+ * receive normalized paths and may treat them as opaque.
170
+ */
171
+ interface FileSystemProvider {
172
+ /**
173
+ * Set of capabilities this provider exposes. Substrate consults
174
+ * this to gate which dispatches the provider can serve (e.g.
175
+ * streaming reads only routed when 'streaming' is declared;
176
+ * sensitive writes only routed when 'encrypted-at-rest' is
177
+ * declared). Optional for backward compatibility with hosts
178
+ * that pre-date data plane / FS providers; absent ≡ empty set.
179
+ */
180
+ capabilities?: Set<FileSystemProviderCapability>;
181
+
182
+ /**
183
+ * Workspace root path. Optional and provider-defined. When
184
+ * supplied, the substrate canonicalizes incoming paths against
185
+ * this root (path-traversal guard) and rejects
186
+ * out-of-root targets. Legacy hosts may omit it; the
187
+ * substrate then falls back to the legacy "trust the path"
188
+ * behaviour.
189
+ */
190
+ cwd?: string;
191
+
192
+ /**
193
+ * Returns the full file tree for the current workspace root.
194
+ */
195
+ getFileTree(): Promise<FileEntry[]>;
196
+
197
+ /**
198
+ * Create a new folder at the given path.
199
+ */
200
+ createFolder(path: string): Promise<void>;
201
+
202
+ /**
203
+ * Delete a folder (and optionally its contents).
204
+ */
205
+ deleteFolder(path: string): Promise<void>;
206
+
207
+ /**
208
+ * Rename / move a folder from oldPath to newPath.
209
+ */
210
+ renameFolder(oldPath: string, newPath: string): Promise<void>;
211
+
212
+ /**
213
+ * Read a file's textual content.
214
+ */
215
+ readFile(path: string): Promise<string>;
216
+
217
+ /**
218
+ * Create a new file with the given textual content.
219
+ */
220
+ createFileWithContent(path: string, content: string): Promise<void>;
221
+
222
+ /**
223
+ * Update an existing file's textual content.
224
+ */
225
+ updateFileContent(path: string, content: string): Promise<void>;
226
+
227
+ /**
228
+ * Delete a file at the given path. By default a missing path
229
+ * throws; pass `{ ifExists: true }` for idempotent delete.
230
+ */
231
+ deleteFile(path: string, opts?: FileDeleteOptions): Promise<void>;
232
+
233
+ /**
234
+ * Rename / move a file from oldPath to newPath.
235
+ */
236
+ renameFile(oldPath: string, newPath: string): Promise<void>;
237
+
238
+ /**
239
+ * Per-path metadata (size, timestamps, mode, isDirectory).
240
+ * Optional: providers that omit this surface should not declare
241
+ * any capability that requires it. Throws when the path does
242
+ * not exist (no silent null).
243
+ */
244
+ stat?(path: string): Promise<FileStat>;
245
+
246
+ /**
247
+ * Existence probe that never throws. Returns true for files
248
+ * AND folders. Optional but recommended — callers presently
249
+ * try/catch readFile() as a workaround.
250
+ */
251
+ exists?(path: string): Promise<boolean>;
252
+
253
+ /**
254
+ * Copy a file or directory tree from src to dst. Optional —
255
+ * legacy hosts that only support rename (= move) should omit.
256
+ */
257
+ copy?(src: string, dst: string): Promise<void>;
258
+
259
+ /**
260
+ * Create a folder, optionally recursive (`mkdir -p`). When the
261
+ * target already exists, behaviour depends on `recursive`:
262
+ * non-recursive throws, recursive is a no-op.
263
+ */
264
+ mkdir?(path: string, opts?: MkdirOptions): Promise<void>;
265
+
266
+ /**
267
+ * Change the POSIX-style permission bits. Optional — most
268
+ * non-native backends (HTTP, IndexedDB) cannot honor this and
269
+ * should omit the method rather than silently no-op.
270
+ */
271
+ chmod?(path: string, mode: number): Promise<void>;
272
+
273
+ /**
274
+ * Create a symbolic link at `linkPath` pointing to `target`.
275
+ * Optional — non-native backends typically omit this.
276
+ */
277
+ symlink?(target: string, linkPath: string): Promise<void>;
278
+
279
+ /**
280
+ * Subscribe to change notifications under `path`. Returns an
281
+ * unsubscribe function. Optional — providers that omit this
282
+ * MUST NOT declare the `'watch'` capability flag. Implementation
283
+ * is host territory (chokidar / fs.watch / IndexedDB observer).
284
+ */
285
+ watch?(path: string, listener: (event: WatchEvent) => void): () => void;
286
+
287
+ /**
288
+ * List entries under `path`. With no args lists root entries;
289
+ * with a `path` lists its direct children; pass
290
+ * `{ recursive: true }` to walk descendants. Returns a flat
291
+ * array — unlike `getFileTree`, entries do NOT carry nested
292
+ * `children`. Callers paginate the array on the consumer side.
293
+ * Throws when the path does not exist or names a file.
294
+ */
295
+ list?(path?: string, opts?: ListOptions): Promise<FileEntry[]>;
296
+
297
+ /**
298
+ * Return the write history for `path`, oldest first. Optional
299
+ * surface gated by the `'versioning'` capability flag — a
300
+ * provider that does not declare `'versioning'` MUST throw
301
+ * when called. Substrate `fs.history` adapter rejects via
302
+ * the gateway before reaching the provider whenever the
303
+ * capability flag is absent.
304
+ */
305
+ history?(path: string): Promise<FileVersion[]>;
306
+
307
+ /**
308
+ * Read the contents `path` had at version `versionId` — the
309
+ * time-travel companion to `history`. Optional surface gated
310
+ * by the `'versioning'` capability flag. Throws when the
311
+ * version id is unknown for the path.
312
+ */
313
+ readAtVersion?(path: string, versionId: string): Promise<string>;
314
+ }
315
+
316
+ type FileMatchMode = 'extension' | 'mime' | 'glob';
317
+
318
+ interface FileMatch {
319
+ /**
320
+ * Matching strategy:
321
+ * - "extension": pattern is compared (case-insensitive) to the file's extension without dot, e.g. "ts", "png".
322
+ * - "mime": pattern is compared to a mime-type, e.g. "image/png" or "text/*".
323
+ * - "glob": simple glob pattern against the full path, e.g. `*.log`.
324
+ */
325
+ mode: FileMatchMode;
326
+ pattern: string;
327
+ }
328
+
329
+ interface FileOpenContext {
330
+ path: string;
331
+ mimeType?: string;
332
+ size?: number;
333
+ }
334
+
335
+ interface FileOpener {
336
+ /**
337
+ * Unique identifier for this opener within the runtime.
338
+ */
339
+ id: string;
340
+ /**
341
+ * Command id that will be executed when this opener is selected.
342
+ * The convention is that commands accept at least (path: string, content: string, ctx?: FileOpenContext).
343
+ */
344
+ command: string;
345
+ /**
346
+ * Matching rules for this opener. When omitted or empty, the opener is considered a "fallback" candidate.
347
+ */
348
+ matches?: FileMatch[];
349
+ /**
350
+ * Higher priority openers win when multiple candidates match the same file.
351
+ * Default is 0.
352
+ */
353
+ priority?: number;
354
+ }
355
+
356
+ interface ResolvedOpener {
357
+ opener: FileOpener;
358
+ command: string;
359
+ }
360
+
361
+ /**
362
+ * File opener registry capability: maps file types to commands.
363
+ */
364
+ interface FileOpenersApi {
365
+ /**
366
+ * Register or replace a file opener. If another opener with the same id already
367
+ * exists, it will be replaced.
368
+ */
369
+ register(opener: FileOpener): void;
370
+ /**
371
+ * Unregister a previously registered opener.
372
+ */
373
+ unregister(id: string): void;
374
+ /**
375
+ * Remove all registered openers.
376
+ */
377
+ clear(): void;
378
+ /**
379
+ * Resolve the most appropriate opener for the given file context.
380
+ * Returns null when no suitable opener is found.
381
+ */
382
+ resolve(ctx: FileOpenContext): ResolvedOpener | null;
383
+ }
384
+ }
385
+ }