@punica/editor 1.0.6 → 1.0.8

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 +2 -1
  2. package/dist/index.bundle.esm.js.map +1 -1
  3. package/dist/index.bundle.umd.js +2 -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 +766 -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 +71 -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,254 @@
1
+ declare module 'punica' {
2
+ export namespace runtime {
3
+ export namespace models {
4
+ /**
5
+ * Model provider identifier (e.g., "huggingface", "bedrock", "local").
6
+ */
7
+ export type ModelProviderId = string;
8
+
9
+ /**
10
+ * Model task types supported by the runtime.
11
+ */
12
+ export type ModelTask =
13
+ | 'text-generation'
14
+ | 'chat'
15
+ | 'embeddings'
16
+ | 'image-generation'
17
+ | 'speech-to-text'
18
+ | 'text-to-speech'
19
+ | 'rerank'
20
+ | 'vision';
21
+
22
+ /**
23
+ * On-disk weight format of a local model. Drives runtime dispatch
24
+ * (see docs/model-runtimes.md). 'unknown' means detection was
25
+ * inconclusive and the dispatcher must decide or error.
26
+ */
27
+ export type ModelFormat = 'gguf' | 'safetensors' | 'onnx' | 'unknown';
28
+
29
+ /**
30
+ * Reference to a model in a specific provider.
31
+ */
32
+ export interface ModelRef {
33
+ /**
34
+ * Provider identifier (e.g., "huggingface", "bedrock", "local").
35
+ */
36
+ provider: ModelProviderId;
37
+ /**
38
+ * Model identifier within the provider.
39
+ * Examples:
40
+ * - HuggingFace: "meta-llama/Llama-3.1-8B-Instruct"
41
+ * - Bedrock: "anthropic.claude-3-5-sonnet-20241022-v2:0"
42
+ * - Local: file path or identifier
43
+ */
44
+ id: string;
45
+ /**
46
+ * Optional revision/version identifier.
47
+ * - HuggingFace: git SHA/tag
48
+ * - Local: hash
49
+ */
50
+ revision?: string;
51
+ /**
52
+ * Model task type.
53
+ */
54
+ task: ModelTask;
55
+ }
56
+
57
+ /**
58
+ * Metadata about a model.
59
+ */
60
+ export interface ModelMetadata {
61
+ /**
62
+ * Reference to the model.
63
+ */
64
+ ref: ModelRef;
65
+ /**
66
+ * Human-readable name.
67
+ */
68
+ name: string;
69
+ /**
70
+ * Optional context window size (in tokens).
71
+ */
72
+ contextWindow?: number;
73
+ /**
74
+ * Optional supported modalities.
75
+ */
76
+ modalities?: Array<'text' | 'image' | 'audio'>;
77
+ /**
78
+ * Optional pricing information.
79
+ */
80
+ pricing?: {
81
+ unit: 'per_1k_tokens' | 'per_second' | 'per_image';
82
+ input?: number;
83
+ output?: number;
84
+ };
85
+ /**
86
+ * Optional limits and constraints.
87
+ */
88
+ limits?: {
89
+ maxInputTokens?: number;
90
+ maxOutputTokens?: number;
91
+ rateLimitPerMin?: number;
92
+ };
93
+ }
94
+
95
+ /**
96
+ * A mounted model that is accessible via a canonical endpoint.
97
+ */
98
+ export interface ModelHandle {
99
+ /**
100
+ * Reference to the model.
101
+ */
102
+ ref: ModelRef;
103
+ /**
104
+ * Canonical endpoint for accessing the model in compute/llm contexts.
105
+ * Format: "punica://model/{provider}/{id}"
106
+ */
107
+ endpoint: string;
108
+ /**
109
+ * Authentication mode for the model endpoint.
110
+ * - 'host': Host handles authentication (e.g., Electron with API keys)
111
+ * - 'provider': Provider handles authentication (e.g., Bedrock with AWS credentials)
112
+ * - 'none': No authentication required
113
+ */
114
+ authMode?: 'host' | 'provider' | 'none';
115
+ }
116
+
117
+ /**
118
+ * Options for mounting a model.
119
+ */
120
+ export interface MountOptions {
121
+ /**
122
+ * Authentication mode for the model endpoint.
123
+ */
124
+ authMode?: 'host' | 'provider' | 'none';
125
+ }
126
+
127
+ /**
128
+ * Options for listing models.
129
+ */
130
+ export interface ListOptions {
131
+ /**
132
+ * Optional task filter.
133
+ */
134
+ task?: ModelTask;
135
+ /**
136
+ * Optional search query.
137
+ */
138
+ query?: string;
139
+ }
140
+
141
+ /**
142
+ * Model provider interface (implemented by extensions).
143
+ */
144
+ export interface ModelProvider {
145
+ /**
146
+ * Unique provider identifier.
147
+ */
148
+ id: ModelProviderId;
149
+ /**
150
+ * Resolve model metadata from a reference.
151
+ */
152
+ resolve(ref: ModelRef): Promise<ModelMetadata>;
153
+ /**
154
+ * Mount a model and return a canonical endpoint for access.
155
+ */
156
+ mount(ref: ModelRef, opts?: MountOptions): Promise<ModelHandle>;
157
+ /**
158
+ * Unmount a model by endpoint.
159
+ */
160
+ unmount(endpoint: string): Promise<void>;
161
+ /**
162
+ * List available models from this provider.
163
+ */
164
+ list(opts?: ListOptions): Promise<ModelMetadata[]>;
165
+ }
166
+
167
+ /**
168
+ * Registry for model providers.
169
+ */
170
+ export interface ModelRegistry {
171
+ /**
172
+ * Register a model provider.
173
+ */
174
+ registerProvider(provider: ModelProvider): void;
175
+ /**
176
+ * Get a provider by ID.
177
+ */
178
+ getProvider(id: ModelProviderId): ModelProvider | undefined;
179
+ /**
180
+ * List all registered providers.
181
+ */
182
+ listProviders(): ModelProvider[];
183
+ }
184
+
185
+ /**
186
+ * Main models API surface.
187
+ */
188
+ export interface ModelsApi {
189
+ /**
190
+ * Resolve model metadata from a reference.
191
+ */
192
+ resolve(ref: ModelRef): Promise<ModelMetadata>;
193
+ /**
194
+ * Mount a model and return a canonical endpoint for access.
195
+ */
196
+ mount(ref: ModelRef, opts?: MountOptions): Promise<ModelHandle>;
197
+ /**
198
+ * Unmount a model by endpoint.
199
+ */
200
+ unmount(endpoint: string): Promise<void>;
201
+ /**
202
+ * List available models.
203
+ * If provider is specified, only lists from that provider.
204
+ * Otherwise, aggregates results from all providers.
205
+ */
206
+ list(opts?: {
207
+ provider?: ModelProviderId;
208
+ task?: ModelTask;
209
+ query?: string;
210
+ }): Promise<ModelMetadata[]>;
211
+ /**
212
+ * Registry for providers.
213
+ */
214
+ registry: ModelRegistry;
215
+ }
216
+
217
+ /**
218
+ * Local storage format for workspace models.
219
+ * Used by LocalModelProvider for .punica/models.json
220
+ */
221
+ export interface LocalModelRecord {
222
+ id: string;
223
+ provider: string;
224
+ name: string;
225
+ identifier: string;
226
+ task: ModelTask;
227
+ contextWindow?: number;
228
+ modalities?: Array<'text' | 'image' | 'audio'>;
229
+ description?: string;
230
+ createdAt?: string;
231
+ updatedAt?: string;
232
+ filePath?: string;
233
+ /**
234
+ * Directory holding a multi-file model (ONNX/genai: model.onnx +
235
+ * external data + tokenizer + genai_config.json). When set, runtimes
236
+ * prefer it over `filePath` (which assumes a single weights file).
237
+ */
238
+ dirPath?: string;
239
+ /** Detected on-disk weight format; drives runtime dispatch. */
240
+ format?: ModelFormat;
241
+ /** Resolved runtime id (e.g. "gguf"); set by the dispatcher. */
242
+ runtime?: string;
243
+ }
244
+
245
+ /**
246
+ * Index file format for local models storage.
247
+ */
248
+ export interface LocalModelsIndexFile {
249
+ version?: number;
250
+ models?: LocalModelRecord[];
251
+ }
252
+ }
253
+ }
254
+ }
@@ -0,0 +1,59 @@
1
+ declare module 'punica' {
2
+ export namespace runtime {
3
+ /**
4
+ * Search capability models.
5
+ */
6
+ interface SearchMatch {
7
+ line: number;
8
+ col: number;
9
+ text: string;
10
+ cell_idx?: number | null;
11
+ cell_line?: number | null;
12
+ cell_id?: string | null;
13
+ cell_type?: string | null;
14
+ }
15
+
16
+ interface SearchFileResult {
17
+ file: string;
18
+ matchCount: number;
19
+ matches: SearchMatch[];
20
+ }
21
+
22
+ interface SearchResponse {
23
+ results: SearchFileResult[];
24
+ }
25
+
26
+ interface SearchQueryOptions {
27
+ q: string;
28
+ limit?: number;
29
+ /** Exact-case matching. Default false (index is case-insensitive). */
30
+ caseSensitive?: boolean;
31
+ /** Match whole words only. Default false. */
32
+ wholeWord?: boolean;
33
+ /** Treat `q` as a regular expression (bypasses the FTS index). Default false. */
34
+ isRegex?: boolean;
35
+ /** Glob of paths to include (e.g. "src/**"). Default all. */
36
+ include?: string;
37
+ /** Comma-separated globs of paths to exclude. */
38
+ exclude?: string;
39
+ }
40
+
41
+ /**
42
+ * Search capability: workspace-wide full-text search and index management.
43
+ */
44
+ interface SearchApi {
45
+ /**
46
+ * Execute a text search against the workspace index.
47
+ */
48
+ query(options: SearchQueryOptions): Promise<SearchResponse>;
49
+
50
+ /**
51
+ * (Optional) Trigger a full or incremental index operation.
52
+ * Implementations may ignore this if indexing is managed externally.
53
+ */
54
+ startIndex?(options?: {
55
+ verbose?: boolean;
56
+ }): Promise<void | { addedOrUpdated: number; removed: number }>;
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,26 @@
1
+ declare module 'punica' {
2
+ export namespace runtime {
3
+ export type SecretName = string;
4
+
5
+ export interface SecretRecord {
6
+ name: SecretName;
7
+ createdAtMs: number;
8
+ updatedAtMs: number;
9
+ }
10
+
11
+ /**
12
+ * Minimal secrets API (v1 MVP).
13
+ *
14
+ * Notes:
15
+ * - In-memory only (no vault/persistence).
16
+ * - Intended primarily for preventing secrets from leaking in trace exports
17
+ * and enabling simple { secretRef } resolution for capabilities.
18
+ */
19
+ export interface SecretsApi {
20
+ set(name: SecretName, value: string): void;
21
+ get(name: SecretName): string | null;
22
+ delete(name: SecretName): boolean;
23
+ list(): SecretRecord[];
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,27 @@
1
+ declare module 'punica' {
2
+ export namespace runtime {
3
+ export interface TaskRunRequest {
4
+ command: string;
5
+ args?: string[];
6
+ cwd?: string;
7
+ env?: Record<string, string>;
8
+ }
9
+
10
+ export interface TaskRunResult {
11
+ exitCode: number | null;
12
+ stdout: string;
13
+ stderr: string;
14
+ }
15
+
16
+ /**
17
+ * Host-backed task runner capability.
18
+ *
19
+ * This is intentionally small and separate from kernel.Tasks (which models
20
+ * task definitions/runs). Here we only expose a "run a command" primitive
21
+ * suitable for capabilities like `tasks.run`.
22
+ */
23
+ export interface TaskRunnerApi {
24
+ run(request: TaskRunRequest): Promise<TaskRunResult>;
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,67 @@
1
+ declare module 'punica' {
2
+ export namespace runtime {
3
+ /**
4
+ * Version control (Git) capability models.
5
+ * These are intentionally minimal and based on simple-git / service-version-control-system responses.
6
+ */
7
+ interface VcsStatusSummary {
8
+ current: string | null;
9
+ tracking?: string | null;
10
+ ahead?: number;
11
+ behind?: number;
12
+ staged: string[];
13
+ modified: string[];
14
+ created: string[];
15
+ deleted: string[];
16
+ renamed: string[];
17
+ conflicted: string[];
18
+ not_added: string[];
19
+ }
20
+
21
+ interface VcsBranch {
22
+ name: string;
23
+ current: boolean;
24
+ }
25
+
26
+ interface VcsCommit {
27
+ hash: string;
28
+ date: string;
29
+ message: string;
30
+ authorName?: string;
31
+ authorEmail?: string;
32
+ }
33
+
34
+ /**
35
+ * Version control capability: high-level Git operations for the workspace repository.
36
+ */
37
+ interface VcsApi {
38
+ status(): Promise<VcsStatusSummary>;
39
+ branches(): Promise<VcsBranch[]>;
40
+ logs(options?: { limit?: number }): Promise<VcsCommit[]>;
41
+
42
+ init(options?: { defaultBranch?: string }): Promise<void>;
43
+ clone(options: {
44
+ url: string;
45
+ directory?: string;
46
+ branch?: string;
47
+ }): Promise<void>;
48
+
49
+ commit(options: { message: string; all?: boolean }): Promise<void>;
50
+ stage(paths: string[]): Promise<void>;
51
+ unstage(paths: string[]): Promise<void>;
52
+ discard(paths: string[]): Promise<void>;
53
+ reset(options?: { hard?: boolean; commit?: string }): Promise<void>;
54
+
55
+ switchBranch(name: string): Promise<void>;
56
+ createBranch(name: string, checkout?: boolean): Promise<void>;
57
+
58
+ fetch(options?: { remote?: string; branch?: string }): Promise<void>;
59
+ pull(options?: { remote?: string; branch?: string }): Promise<void>;
60
+ push(options?: {
61
+ remote?: string;
62
+ branch?: string;
63
+ setUpstream?: boolean;
64
+ }): Promise<void>;
65
+ }
66
+ }
67
+ }
@@ -0,0 +1,74 @@
1
+ declare module 'punica' {
2
+ export namespace runtime {
3
+ /**
4
+ * Local vector index — a small, product-neutral similarity store. It pairs
5
+ * with `runtime.inference` embeddings to close the RAG gap: callers embed
6
+ * text (or images) into vectors, `upsert` them here, then `query` by a vector
7
+ * to retrieve the nearest records (cosine). It is a PURE vector store — it
8
+ * never computes embeddings itself, so it stays engine-agnostic. See
9
+ * docs/model-runtimes.md §9.8.
10
+ *
11
+ * The default substrate implementation is in-memory with best-effort
12
+ * persistence to `.punica/vectors/<collection>.json`; a host may inject a
13
+ * real vector DB via `setVectorsProvider`.
14
+ */
15
+ export namespace vectors {
16
+ /** A stored vector plus the payload returned on a match. */
17
+ export interface VectorRecord {
18
+ /** Stable id; re-upserting the same id replaces the record. */
19
+ id: string;
20
+ /** The embedding vector. */
21
+ vector: number[];
22
+ /** Optional original text (returned on matches; handy for RAG). */
23
+ text?: string;
24
+ /** Optional arbitrary metadata (returned on matches). */
25
+ metadata?: Record<string, unknown>;
26
+ }
27
+
28
+ /** A nearest-neighbour query. */
29
+ export interface VectorQuery {
30
+ /** Query vector to score every stored record against. */
31
+ vector: number[];
32
+ /** Max matches to return, best-first (default 10). */
33
+ topK?: number;
34
+ /** Collection to search (default 'default'). */
35
+ collection?: string;
36
+ }
37
+
38
+ /** A single query match. */
39
+ export interface VectorMatch {
40
+ id: string;
41
+ /** Cosine similarity in [-1, 1] (higher = more similar). */
42
+ score: number;
43
+ text?: string;
44
+ metadata?: Record<string, unknown>;
45
+ }
46
+
47
+ /** Options selecting a collection for a mutation. */
48
+ export interface CollectionOptions {
49
+ /** Collection name (default 'default'). */
50
+ collection?: string;
51
+ }
52
+
53
+ /**
54
+ * Vector index surface (`runtime.vectors`). Collections are independent
55
+ * namespaces within the store.
56
+ */
57
+ export interface VectorsApi {
58
+ /** Insert or replace records (by id) in a collection. */
59
+ upsert(
60
+ records: VectorRecord[],
61
+ opts?: CollectionOptions
62
+ ): Promise<void>;
63
+ /** Return the `topK` nearest records to `q.vector`, best-first. */
64
+ query(q: VectorQuery): Promise<VectorMatch[]>;
65
+ /** Remove records by id from a collection. */
66
+ delete(ids: string[], opts?: CollectionOptions): Promise<void>;
67
+ /** Remove every record from a collection. */
68
+ clear(opts?: CollectionOptions): Promise<void>;
69
+ /** Number of records in a collection. */
70
+ count(opts?: CollectionOptions): Promise<number>;
71
+ }
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,134 @@
1
+ declare module 'punica' {
2
+ export namespace runtime {
3
+ export type WorkspaceId = string;
4
+ export type EnvironmentId = string;
5
+ export type ResourceId = string;
6
+
7
+ export type WorkspaceKind = 'code' | 'data' | 'ml' | 'mono' | 'custom';
8
+
9
+ export interface Environment {
10
+ id: EnvironmentId;
11
+ name: string;
12
+ description?: string;
13
+ /**
14
+ * Environment-scoped variables. The host is responsible for mapping these
15
+ * to real process/env or remote runtime variables.
16
+ */
17
+ variables?: Record<string, string>;
18
+ /**
19
+ * Default bindings for this environment (e.g. default database, dataset).
20
+ */
21
+ bindings?: Record<string, ResourceId>;
22
+ }
23
+
24
+ export interface WorkspaceSummary {
25
+ id: WorkspaceId;
26
+ name: string;
27
+ kind: WorkspaceKind;
28
+ /**
29
+ * Workspace root URI understood by the host (e.g. file://, git://, s3://).
30
+ */
31
+ rootUri: string;
32
+ /**
33
+ * Last active environment id, if any.
34
+ */
35
+ currentEnvironmentId?: EnvironmentId;
36
+ tags?: string[];
37
+ }
38
+
39
+ export interface Workspace extends WorkspaceSummary {
40
+ environments: Environment[];
41
+ /**
42
+ * Resource identifiers associated with this workspace. Detailed metadata
43
+ * is retrieved via the ResourcesApi.
44
+ */
45
+ resourceIds?: ResourceId[];
46
+ metadata?: Record<string, unknown>;
47
+ }
48
+
49
+ export type ResourceKind =
50
+ | 'dataset'
51
+ | 'service'
52
+ | 'secret'
53
+ | 'agent'
54
+ | 'flow'
55
+ | 'notebook'
56
+ | 'config'
57
+ | 'custom';
58
+
59
+ export interface Resource {
60
+ id: ResourceId;
61
+ kind: ResourceKind;
62
+ name: string;
63
+ /**
64
+ * Logical location of the resource within the workspace (path, URI, etc.).
65
+ */
66
+ uri?: string;
67
+ /**
68
+ * Type-specific metadata (schema, owner, region, model id, etc.).
69
+ */
70
+ metadata?: Record<string, unknown>;
71
+ tags?: string[];
72
+ workspaceId?: WorkspaceId;
73
+ }
74
+
75
+ export interface WorkspaceApi {
76
+ /**
77
+ * Returns the currently active workspace with full details, or null when
78
+ * no workspace is open.
79
+ */
80
+ getCurrent(): Promise<Workspace | null>;
81
+ /**
82
+ * Lists all known workspaces on this host/installation.
83
+ */
84
+ list(): Promise<WorkspaceSummary[]>;
85
+ /**
86
+ * Switches to another workspace. Hosts control how this is implemented
87
+ * (e.g. opening a new window, reloading, etc.).
88
+ */
89
+ open(id: WorkspaceId): Promise<Workspace>;
90
+ /**
91
+ * Changes the active environment for the given workspace.
92
+ */
93
+ setEnvironment(
94
+ workspaceId: WorkspaceId,
95
+ envId: EnvironmentId
96
+ ): Promise<Workspace>;
97
+ /**
98
+ * Subscribe to workspace changes. Returns an unsubscribe function.
99
+ */
100
+ onDidChange(listener: (workspace: Workspace | null) => void): () => void;
101
+ }
102
+
103
+ export interface ResourcesQuery {
104
+ kinds?: ResourceKind[];
105
+ workspaceId?: WorkspaceId;
106
+ tags?: string[];
107
+ text?: string;
108
+ }
109
+
110
+ export interface ResourcesApi {
111
+ /**
112
+ * Lists resources matching the optional query filters.
113
+ */
114
+ list(query?: ResourcesQuery): Promise<Resource[]>;
115
+ /**
116
+ * Returns a single resource by id, or null when not found.
117
+ */
118
+ get(id: ResourceId): Promise<Resource | null>;
119
+ /**
120
+ * Allows extensions to register logical resources that they own or
121
+ * manage. Hosts may choose to persist these or derive them dynamically.
122
+ */
123
+ register(resource: Resource): void;
124
+ /**
125
+ * Unregister a previously registered resource.
126
+ */
127
+ unregister(id: ResourceId): void;
128
+ /**
129
+ * Subscribe to resource catalog changes. Returns an unsubscribe function.
130
+ */
131
+ onDidChange(listener: () => void): () => void;
132
+ }
133
+ }
134
+ }
@@ -0,0 +1,42 @@
1
+ declare module 'punica' {
2
+ export namespace shell {
3
+ export namespace ActivityBar {
4
+ type Alignment = 'primary' | 'secondary';
5
+ type ItemType = 'normal' | 'menu';
6
+
7
+ interface IItem {
8
+ id: string;
9
+ name: string;
10
+ alignment: Alignment;
11
+ title: string;
12
+ icon: string;
13
+ /**
14
+ * Optional command to execute when the activity bar item is clicked.
15
+ * This is typically a lightweight "open/focus" command that can
16
+ * trigger lazy activation via `onCommand:<id>` if needed.
17
+ */
18
+ command?: string;
19
+ /**
20
+ * Optional logical view id this activity item controls (e.g. the
21
+ * primarySidebar view id from `.punica/config.yaml`). When provided,
22
+ * the core can automatically show/hide the correct sidebar host.
23
+ */
24
+ viewId?: string;
25
+ }
26
+
27
+ interface IActivityBarManager {
28
+ addItem(item: IItem): void;
29
+ removeItem(itemId: string): void;
30
+ /**
31
+ * Optional helper for hosts/core to sync ActivityBar selection with the
32
+ * currently visible primarySidebar view. When a view id is provided,
33
+ * the manager should mark the corresponding item (if any) as active.
34
+ * Passing null clears the current selection.
35
+ */
36
+ setActiveByViewId?(viewId: string | null): void;
37
+ }
38
+
39
+ export const manager: IActivityBarManager;
40
+ }
41
+ }
42
+ }