@pooder/core 2.0.0 → 2.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @pooder/core
2
2
 
3
+ ## 2.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - service
8
+
9
+ ## 2.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - white ink tool and size tool
14
+
3
15
  ## 2.0.0
4
16
 
5
17
  ### Major Changes
package/dist/index.d.mts CHANGED
@@ -1,15 +1,3 @@
1
- interface Service {
2
- init?(): void;
3
- dispose?(): void;
4
- }
5
- declare class ServiceRegistry {
6
- private services;
7
- register<T extends Service>(name: string, service: T): T;
8
- get<T extends Service>(serviceName: string): T | undefined;
9
- has(serviceName: string): boolean;
10
- delete(serviceName: string): void;
11
- }
12
-
13
1
  type EventHandler = (...args: any[]) => void | boolean;
14
2
  declare class EventBus {
15
3
  private events;
@@ -20,6 +8,52 @@ declare class EventBus {
20
8
  count(event: string): number;
21
9
  }
22
10
 
11
+ interface Service {
12
+ init?(context: ServiceContext): void | Promise<void>;
13
+ dispose?(context: ServiceContext): void | Promise<void>;
14
+ }
15
+ interface ServiceToken<T extends Service = Service> {
16
+ readonly kind: "service-token";
17
+ readonly key: symbol;
18
+ readonly name: string;
19
+ }
20
+ type ServiceIdentifier<T extends Service = Service> = string | ServiceToken<T>;
21
+ interface ServiceContext {
22
+ readonly eventBus: EventBus;
23
+ get<T extends Service>(identifier: ServiceIdentifier<T>): T | undefined;
24
+ getOrThrow<T extends Service>(identifier: ServiceIdentifier<T>, errorMessage?: string): T;
25
+ has(identifier: ServiceIdentifier<Service>): boolean;
26
+ }
27
+ interface RegisterServiceOptions {
28
+ allowOverride?: boolean;
29
+ }
30
+ interface RegisteredService<T extends Service = Service> {
31
+ readonly id: string;
32
+ readonly token?: ServiceToken<T>;
33
+ readonly service: T;
34
+ }
35
+ declare function createServiceToken<T extends Service = Service>(name: string): ServiceToken<T>;
36
+ declare function isServiceToken<T extends Service = Service>(identifier: unknown): identifier is ServiceToken<T>;
37
+ declare class ServiceRegistry {
38
+ private readonly servicesByName;
39
+ private readonly servicesByToken;
40
+ private readonly registrationOrder;
41
+ register<T extends Service>(identifier: ServiceIdentifier<T>, service: T, options?: RegisterServiceOptions): T;
42
+ get<T extends Service>(identifier: ServiceIdentifier<T>): T | undefined;
43
+ get<T extends Service>(identifier: ServiceToken<T>): T | undefined;
44
+ get<T extends Service>(identifier: string): T | undefined;
45
+ getOrThrow<T extends Service>(identifier: ServiceIdentifier<T>, errorMessage?: string): T;
46
+ getOrThrow<T extends Service>(identifier: ServiceToken<T>, errorMessage?: string): T;
47
+ getOrThrow<T extends Service>(identifier: string, errorMessage?: string): T;
48
+ has(identifier: ServiceIdentifier<Service>): boolean;
49
+ delete(identifier: ServiceIdentifier<Service>): boolean;
50
+ list(): RegisteredService[];
51
+ clear(): void;
52
+ private findEntry;
53
+ private normalizeIdentifier;
54
+ private removeEntry;
55
+ }
56
+
23
57
  interface ContributionPoint<T = any> {
24
58
  id: string;
25
59
  description?: string;
@@ -37,12 +71,33 @@ interface CommandContribution {
37
71
  /**
38
72
  * Tool Contribution Data Definition
39
73
  */
74
+ type ToolInteraction = "instant" | "session" | "hybrid";
75
+ type ToolSessionLeavePolicy = "block" | "commit" | "rollback";
76
+ interface ToolCommandBindings {
77
+ execute?: string;
78
+ begin?: string;
79
+ validate?: string;
80
+ commit?: string;
81
+ rollback?: string;
82
+ reset?: string;
83
+ }
40
84
  interface ToolContribution {
41
85
  id: string;
42
86
  name: string;
43
- description: string;
87
+ description?: string;
88
+ icon?: string;
89
+ interaction: ToolInteraction;
44
90
  parameters?: Record<string, any>;
45
- execute: (...args: any[]) => Promise<any>;
91
+ commands?: ToolCommandBindings;
92
+ view?: {
93
+ id?: string;
94
+ type?: "sidebar" | "panel" | "editor" | "dialog";
95
+ location?: string;
96
+ };
97
+ session?: {
98
+ autoBegin?: boolean;
99
+ leavePolicy?: ToolSessionLeavePolicy;
100
+ };
46
101
  }
47
102
  /**
48
103
  * View Contribution Data Definition
@@ -125,7 +180,9 @@ interface Contribution<T = any> {
125
180
  interface ExtensionContext {
126
181
  readonly eventBus: EventBus;
127
182
  readonly services: {
128
- get<T extends Service>(serviceName: string): T | undefined;
183
+ get<T extends Service>(identifier: ServiceIdentifier<T>): T | undefined;
184
+ getOrThrow<T extends Service>(identifier: ServiceIdentifier<T>, errorMessage?: string): T;
185
+ has(identifier: ServiceIdentifier<Service>): boolean;
129
186
  };
130
187
  readonly contributions: {
131
188
  get<T>(pointId: string): Contribution<T>[];
@@ -249,29 +306,147 @@ declare class ConfigurationService implements Service {
249
306
  dispose(): void;
250
307
  }
251
308
 
309
+ declare class ToolRegistryService implements Service {
310
+ private tools;
311
+ registerTool(tool: ToolContribution): Disposable;
312
+ unregisterTool(toolId: string): void;
313
+ getTool(toolId: string): ToolContribution | undefined;
314
+ listTools(): ToolContribution[];
315
+ hasTool(toolId: string): boolean;
316
+ dispose(): void;
317
+ }
318
+
319
+ type ToolSessionStatus = "idle" | "active";
320
+ interface ToolSessionState {
321
+ toolId: string;
322
+ status: ToolSessionStatus;
323
+ dirty: boolean;
324
+ startedAt?: number;
325
+ lastUpdatedAt?: number;
326
+ }
327
+ type LeaveDecision = "allow" | "blocked";
328
+ interface LeaveResult {
329
+ decision: LeaveDecision;
330
+ reason?: string;
331
+ }
332
+ interface ToolSessionServiceDependencies {
333
+ commandService?: CommandService;
334
+ toolRegistry?: ToolRegistryService;
335
+ }
336
+ declare class ToolSessionService implements Service {
337
+ private readonly sessions;
338
+ private commandService?;
339
+ private toolRegistry?;
340
+ constructor(dependencies?: ToolSessionServiceDependencies);
341
+ init(context: ServiceContext): void;
342
+ setCommandService(commandService: CommandService): void;
343
+ setToolRegistry(toolRegistry: ToolRegistryService): void;
344
+ registerDirtyTracker(toolId: string, callback: () => boolean): Disposable;
345
+ private readonly dirtyTrackers;
346
+ private ensureSession;
347
+ getState(toolId: string): ToolSessionState;
348
+ isDirty(toolId: string): boolean;
349
+ markDirty(toolId: string, dirty?: boolean): void;
350
+ private resolveTool;
351
+ private runCommand;
352
+ private getCommandService;
353
+ private getToolRegistry;
354
+ begin(toolId: string): Promise<void>;
355
+ validate(toolId: string): Promise<{
356
+ ok: boolean;
357
+ result?: any;
358
+ }>;
359
+ commit(toolId: string): Promise<{
360
+ ok: boolean;
361
+ result?: any;
362
+ }>;
363
+ rollback(toolId: string): Promise<void>;
364
+ deactivateSession(toolId: string): void;
365
+ handleBeforeLeave(toolId: string): Promise<LeaveResult>;
366
+ dispose(): void;
367
+ }
368
+
369
+ interface ToolSwitchContext {
370
+ from: string | null;
371
+ to: string | null;
372
+ reason?: string;
373
+ }
374
+ interface ToolSwitchResult {
375
+ ok: boolean;
376
+ from: string | null;
377
+ to: string | null;
378
+ reason?: string;
379
+ }
380
+ type ToolSwitchGuard = (context: ToolSwitchContext) => boolean | Promise<boolean>;
381
+ interface WorkbenchServiceDependencies {
382
+ eventBus?: EventBus;
383
+ toolRegistry?: ToolRegistryService;
384
+ sessionService?: ToolSessionService;
385
+ }
252
386
  declare class WorkbenchService implements Service {
253
387
  private _activeToolId;
254
388
  private eventBus?;
255
- init(): void;
389
+ private toolRegistry?;
390
+ private sessionService?;
391
+ private guards;
392
+ constructor(dependencies?: WorkbenchServiceDependencies);
393
+ init(context: ServiceContext): void;
256
394
  dispose(): void;
257
395
  setEventBus(bus: EventBus): void;
396
+ setToolRegistry(toolRegistry: ToolRegistryService): void;
397
+ setToolSessionService(sessionService: ToolSessionService): void;
258
398
  get activeToolId(): string | null;
259
- activate(id: string): void;
399
+ registerSwitchGuard(guard: ToolSwitchGuard, priority?: number): Disposable;
400
+ private runGuards;
401
+ switchTool(id: string | null, options?: {
402
+ reason?: string;
403
+ }): Promise<ToolSwitchResult>;
404
+ activate(id: string | null): Promise<ToolSwitchResult>;
405
+ deactivate(): Promise<ToolSwitchResult>;
406
+ private getEventBus;
407
+ private getToolRegistry;
408
+ private getSessionService;
260
409
  }
261
410
 
411
+ declare const COMMAND_SERVICE: ServiceToken<CommandService>;
412
+ declare const CONFIGURATION_SERVICE: ServiceToken<ConfigurationService>;
413
+ declare const TOOL_REGISTRY_SERVICE: ServiceToken<ToolRegistryService>;
414
+ declare const TOOL_SESSION_SERVICE: ServiceToken<ToolSessionService>;
415
+ declare const WORKBENCH_SERVICE: ServiceToken<WorkbenchService>;
416
+ declare const CORE_SERVICE_TOKENS: {
417
+ readonly COMMAND: ServiceToken<CommandService>;
418
+ readonly CONFIGURATION: ServiceToken<ConfigurationService>;
419
+ readonly TOOL_REGISTRY: ServiceToken<ToolRegistryService>;
420
+ readonly TOOL_SESSION: ServiceToken<ToolSessionService>;
421
+ readonly WORKBENCH: ServiceToken<WorkbenchService>;
422
+ };
423
+
262
424
  declare class Pooder {
263
425
  readonly eventBus: EventBus;
264
426
  private readonly services;
427
+ private readonly serviceContext;
265
428
  private readonly contributions;
266
429
  readonly extensionManager: ExtensionManager;
267
430
  constructor();
268
431
  private initDefaultContributionPoints;
269
- registerService(service: Service, id?: string): boolean;
270
- unregisterService(service: Service, id?: string): boolean;
271
- getService<T extends Service>(id: string): T | undefined;
432
+ registerService<T extends Service>(service: T, identifier?: ServiceIdentifier<T>, options?: RegisterServiceOptions): boolean;
433
+ registerServiceAsync<T extends Service>(service: T, identifier?: ServiceIdentifier<T>, options?: RegisterServiceOptions): Promise<boolean>;
434
+ unregisterService(service: Service, id?: ServiceIdentifier<Service>): boolean;
435
+ unregisterService(identifier: ServiceIdentifier<Service>): boolean;
436
+ unregisterServiceAsync(serviceOrIdentifier: Service | ServiceIdentifier<Service>, id?: ServiceIdentifier<Service>): Promise<boolean>;
437
+ getService<T extends Service>(identifier: ServiceIdentifier<T>): T | undefined;
438
+ getServiceOrThrow<T extends Service>(identifier: ServiceIdentifier<T>, errorMessage?: string): T;
439
+ hasService(identifier: ServiceIdentifier<Service>): boolean;
440
+ dispose(): Promise<void>;
272
441
  registerContributionPoint<T>(point: ContributionPoint<T>): void;
273
442
  registerContribution<T>(pointId: string, contribution: Contribution<T>): Disposable;
274
443
  getContributions<T>(pointId: string): Contribution<T>[];
444
+ private resolveServiceIdentifier;
445
+ private resolveUnregisterIdentifier;
446
+ private getServiceLabel;
447
+ private invokeServiceHook;
448
+ private invokeServiceHookAsync;
449
+ private isPromiseLike;
275
450
  }
276
451
 
277
- export { type CommandContribution, CommandService, type ConfigurationContribution, ConfigurationService, type Contribution, type ContributionMetadata, type ContributionPoint, ContributionPointIds, ContributionRegistry, EventBus, type Extension, type ExtensionContext, ExtensionManager, type ExtensionMetadata, ExtensionRegistry, Pooder, type Service, ServiceRegistry, type ToolContribution, type ViewContribution, WorkbenchService };
452
+ export { COMMAND_SERVICE, CONFIGURATION_SERVICE, CORE_SERVICE_TOKENS, type CommandContribution, CommandService, type ConfigurationContribution, ConfigurationService, type Contribution, type ContributionMetadata, type ContributionPoint, ContributionPointIds, ContributionRegistry, EventBus, type Extension, type ExtensionContext, ExtensionManager, type ExtensionMetadata, ExtensionRegistry, Pooder, type RegisterServiceOptions, type RegisteredService, type Service, type ServiceContext, type ServiceIdentifier, ServiceRegistry, type ServiceToken, TOOL_REGISTRY_SERVICE, TOOL_SESSION_SERVICE, type ToolCommandBindings, type ToolContribution, type ToolInteraction, ToolRegistryService, type ToolSessionLeavePolicy, ToolSessionService, type ViewContribution, WORKBENCH_SERVICE, WorkbenchService, createServiceToken, isServiceToken };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,3 @@
1
- interface Service {
2
- init?(): void;
3
- dispose?(): void;
4
- }
5
- declare class ServiceRegistry {
6
- private services;
7
- register<T extends Service>(name: string, service: T): T;
8
- get<T extends Service>(serviceName: string): T | undefined;
9
- has(serviceName: string): boolean;
10
- delete(serviceName: string): void;
11
- }
12
-
13
1
  type EventHandler = (...args: any[]) => void | boolean;
14
2
  declare class EventBus {
15
3
  private events;
@@ -20,6 +8,52 @@ declare class EventBus {
20
8
  count(event: string): number;
21
9
  }
22
10
 
11
+ interface Service {
12
+ init?(context: ServiceContext): void | Promise<void>;
13
+ dispose?(context: ServiceContext): void | Promise<void>;
14
+ }
15
+ interface ServiceToken<T extends Service = Service> {
16
+ readonly kind: "service-token";
17
+ readonly key: symbol;
18
+ readonly name: string;
19
+ }
20
+ type ServiceIdentifier<T extends Service = Service> = string | ServiceToken<T>;
21
+ interface ServiceContext {
22
+ readonly eventBus: EventBus;
23
+ get<T extends Service>(identifier: ServiceIdentifier<T>): T | undefined;
24
+ getOrThrow<T extends Service>(identifier: ServiceIdentifier<T>, errorMessage?: string): T;
25
+ has(identifier: ServiceIdentifier<Service>): boolean;
26
+ }
27
+ interface RegisterServiceOptions {
28
+ allowOverride?: boolean;
29
+ }
30
+ interface RegisteredService<T extends Service = Service> {
31
+ readonly id: string;
32
+ readonly token?: ServiceToken<T>;
33
+ readonly service: T;
34
+ }
35
+ declare function createServiceToken<T extends Service = Service>(name: string): ServiceToken<T>;
36
+ declare function isServiceToken<T extends Service = Service>(identifier: unknown): identifier is ServiceToken<T>;
37
+ declare class ServiceRegistry {
38
+ private readonly servicesByName;
39
+ private readonly servicesByToken;
40
+ private readonly registrationOrder;
41
+ register<T extends Service>(identifier: ServiceIdentifier<T>, service: T, options?: RegisterServiceOptions): T;
42
+ get<T extends Service>(identifier: ServiceIdentifier<T>): T | undefined;
43
+ get<T extends Service>(identifier: ServiceToken<T>): T | undefined;
44
+ get<T extends Service>(identifier: string): T | undefined;
45
+ getOrThrow<T extends Service>(identifier: ServiceIdentifier<T>, errorMessage?: string): T;
46
+ getOrThrow<T extends Service>(identifier: ServiceToken<T>, errorMessage?: string): T;
47
+ getOrThrow<T extends Service>(identifier: string, errorMessage?: string): T;
48
+ has(identifier: ServiceIdentifier<Service>): boolean;
49
+ delete(identifier: ServiceIdentifier<Service>): boolean;
50
+ list(): RegisteredService[];
51
+ clear(): void;
52
+ private findEntry;
53
+ private normalizeIdentifier;
54
+ private removeEntry;
55
+ }
56
+
23
57
  interface ContributionPoint<T = any> {
24
58
  id: string;
25
59
  description?: string;
@@ -37,12 +71,33 @@ interface CommandContribution {
37
71
  /**
38
72
  * Tool Contribution Data Definition
39
73
  */
74
+ type ToolInteraction = "instant" | "session" | "hybrid";
75
+ type ToolSessionLeavePolicy = "block" | "commit" | "rollback";
76
+ interface ToolCommandBindings {
77
+ execute?: string;
78
+ begin?: string;
79
+ validate?: string;
80
+ commit?: string;
81
+ rollback?: string;
82
+ reset?: string;
83
+ }
40
84
  interface ToolContribution {
41
85
  id: string;
42
86
  name: string;
43
- description: string;
87
+ description?: string;
88
+ icon?: string;
89
+ interaction: ToolInteraction;
44
90
  parameters?: Record<string, any>;
45
- execute: (...args: any[]) => Promise<any>;
91
+ commands?: ToolCommandBindings;
92
+ view?: {
93
+ id?: string;
94
+ type?: "sidebar" | "panel" | "editor" | "dialog";
95
+ location?: string;
96
+ };
97
+ session?: {
98
+ autoBegin?: boolean;
99
+ leavePolicy?: ToolSessionLeavePolicy;
100
+ };
46
101
  }
47
102
  /**
48
103
  * View Contribution Data Definition
@@ -125,7 +180,9 @@ interface Contribution<T = any> {
125
180
  interface ExtensionContext {
126
181
  readonly eventBus: EventBus;
127
182
  readonly services: {
128
- get<T extends Service>(serviceName: string): T | undefined;
183
+ get<T extends Service>(identifier: ServiceIdentifier<T>): T | undefined;
184
+ getOrThrow<T extends Service>(identifier: ServiceIdentifier<T>, errorMessage?: string): T;
185
+ has(identifier: ServiceIdentifier<Service>): boolean;
129
186
  };
130
187
  readonly contributions: {
131
188
  get<T>(pointId: string): Contribution<T>[];
@@ -249,29 +306,147 @@ declare class ConfigurationService implements Service {
249
306
  dispose(): void;
250
307
  }
251
308
 
309
+ declare class ToolRegistryService implements Service {
310
+ private tools;
311
+ registerTool(tool: ToolContribution): Disposable;
312
+ unregisterTool(toolId: string): void;
313
+ getTool(toolId: string): ToolContribution | undefined;
314
+ listTools(): ToolContribution[];
315
+ hasTool(toolId: string): boolean;
316
+ dispose(): void;
317
+ }
318
+
319
+ type ToolSessionStatus = "idle" | "active";
320
+ interface ToolSessionState {
321
+ toolId: string;
322
+ status: ToolSessionStatus;
323
+ dirty: boolean;
324
+ startedAt?: number;
325
+ lastUpdatedAt?: number;
326
+ }
327
+ type LeaveDecision = "allow" | "blocked";
328
+ interface LeaveResult {
329
+ decision: LeaveDecision;
330
+ reason?: string;
331
+ }
332
+ interface ToolSessionServiceDependencies {
333
+ commandService?: CommandService;
334
+ toolRegistry?: ToolRegistryService;
335
+ }
336
+ declare class ToolSessionService implements Service {
337
+ private readonly sessions;
338
+ private commandService?;
339
+ private toolRegistry?;
340
+ constructor(dependencies?: ToolSessionServiceDependencies);
341
+ init(context: ServiceContext): void;
342
+ setCommandService(commandService: CommandService): void;
343
+ setToolRegistry(toolRegistry: ToolRegistryService): void;
344
+ registerDirtyTracker(toolId: string, callback: () => boolean): Disposable;
345
+ private readonly dirtyTrackers;
346
+ private ensureSession;
347
+ getState(toolId: string): ToolSessionState;
348
+ isDirty(toolId: string): boolean;
349
+ markDirty(toolId: string, dirty?: boolean): void;
350
+ private resolveTool;
351
+ private runCommand;
352
+ private getCommandService;
353
+ private getToolRegistry;
354
+ begin(toolId: string): Promise<void>;
355
+ validate(toolId: string): Promise<{
356
+ ok: boolean;
357
+ result?: any;
358
+ }>;
359
+ commit(toolId: string): Promise<{
360
+ ok: boolean;
361
+ result?: any;
362
+ }>;
363
+ rollback(toolId: string): Promise<void>;
364
+ deactivateSession(toolId: string): void;
365
+ handleBeforeLeave(toolId: string): Promise<LeaveResult>;
366
+ dispose(): void;
367
+ }
368
+
369
+ interface ToolSwitchContext {
370
+ from: string | null;
371
+ to: string | null;
372
+ reason?: string;
373
+ }
374
+ interface ToolSwitchResult {
375
+ ok: boolean;
376
+ from: string | null;
377
+ to: string | null;
378
+ reason?: string;
379
+ }
380
+ type ToolSwitchGuard = (context: ToolSwitchContext) => boolean | Promise<boolean>;
381
+ interface WorkbenchServiceDependencies {
382
+ eventBus?: EventBus;
383
+ toolRegistry?: ToolRegistryService;
384
+ sessionService?: ToolSessionService;
385
+ }
252
386
  declare class WorkbenchService implements Service {
253
387
  private _activeToolId;
254
388
  private eventBus?;
255
- init(): void;
389
+ private toolRegistry?;
390
+ private sessionService?;
391
+ private guards;
392
+ constructor(dependencies?: WorkbenchServiceDependencies);
393
+ init(context: ServiceContext): void;
256
394
  dispose(): void;
257
395
  setEventBus(bus: EventBus): void;
396
+ setToolRegistry(toolRegistry: ToolRegistryService): void;
397
+ setToolSessionService(sessionService: ToolSessionService): void;
258
398
  get activeToolId(): string | null;
259
- activate(id: string): void;
399
+ registerSwitchGuard(guard: ToolSwitchGuard, priority?: number): Disposable;
400
+ private runGuards;
401
+ switchTool(id: string | null, options?: {
402
+ reason?: string;
403
+ }): Promise<ToolSwitchResult>;
404
+ activate(id: string | null): Promise<ToolSwitchResult>;
405
+ deactivate(): Promise<ToolSwitchResult>;
406
+ private getEventBus;
407
+ private getToolRegistry;
408
+ private getSessionService;
260
409
  }
261
410
 
411
+ declare const COMMAND_SERVICE: ServiceToken<CommandService>;
412
+ declare const CONFIGURATION_SERVICE: ServiceToken<ConfigurationService>;
413
+ declare const TOOL_REGISTRY_SERVICE: ServiceToken<ToolRegistryService>;
414
+ declare const TOOL_SESSION_SERVICE: ServiceToken<ToolSessionService>;
415
+ declare const WORKBENCH_SERVICE: ServiceToken<WorkbenchService>;
416
+ declare const CORE_SERVICE_TOKENS: {
417
+ readonly COMMAND: ServiceToken<CommandService>;
418
+ readonly CONFIGURATION: ServiceToken<ConfigurationService>;
419
+ readonly TOOL_REGISTRY: ServiceToken<ToolRegistryService>;
420
+ readonly TOOL_SESSION: ServiceToken<ToolSessionService>;
421
+ readonly WORKBENCH: ServiceToken<WorkbenchService>;
422
+ };
423
+
262
424
  declare class Pooder {
263
425
  readonly eventBus: EventBus;
264
426
  private readonly services;
427
+ private readonly serviceContext;
265
428
  private readonly contributions;
266
429
  readonly extensionManager: ExtensionManager;
267
430
  constructor();
268
431
  private initDefaultContributionPoints;
269
- registerService(service: Service, id?: string): boolean;
270
- unregisterService(service: Service, id?: string): boolean;
271
- getService<T extends Service>(id: string): T | undefined;
432
+ registerService<T extends Service>(service: T, identifier?: ServiceIdentifier<T>, options?: RegisterServiceOptions): boolean;
433
+ registerServiceAsync<T extends Service>(service: T, identifier?: ServiceIdentifier<T>, options?: RegisterServiceOptions): Promise<boolean>;
434
+ unregisterService(service: Service, id?: ServiceIdentifier<Service>): boolean;
435
+ unregisterService(identifier: ServiceIdentifier<Service>): boolean;
436
+ unregisterServiceAsync(serviceOrIdentifier: Service | ServiceIdentifier<Service>, id?: ServiceIdentifier<Service>): Promise<boolean>;
437
+ getService<T extends Service>(identifier: ServiceIdentifier<T>): T | undefined;
438
+ getServiceOrThrow<T extends Service>(identifier: ServiceIdentifier<T>, errorMessage?: string): T;
439
+ hasService(identifier: ServiceIdentifier<Service>): boolean;
440
+ dispose(): Promise<void>;
272
441
  registerContributionPoint<T>(point: ContributionPoint<T>): void;
273
442
  registerContribution<T>(pointId: string, contribution: Contribution<T>): Disposable;
274
443
  getContributions<T>(pointId: string): Contribution<T>[];
444
+ private resolveServiceIdentifier;
445
+ private resolveUnregisterIdentifier;
446
+ private getServiceLabel;
447
+ private invokeServiceHook;
448
+ private invokeServiceHookAsync;
449
+ private isPromiseLike;
275
450
  }
276
451
 
277
- export { type CommandContribution, CommandService, type ConfigurationContribution, ConfigurationService, type Contribution, type ContributionMetadata, type ContributionPoint, ContributionPointIds, ContributionRegistry, EventBus, type Extension, type ExtensionContext, ExtensionManager, type ExtensionMetadata, ExtensionRegistry, Pooder, type Service, ServiceRegistry, type ToolContribution, type ViewContribution, WorkbenchService };
452
+ export { COMMAND_SERVICE, CONFIGURATION_SERVICE, CORE_SERVICE_TOKENS, type CommandContribution, CommandService, type ConfigurationContribution, ConfigurationService, type Contribution, type ContributionMetadata, type ContributionPoint, ContributionPointIds, ContributionRegistry, EventBus, type Extension, type ExtensionContext, ExtensionManager, type ExtensionMetadata, ExtensionRegistry, Pooder, type RegisterServiceOptions, type RegisteredService, type Service, type ServiceContext, type ServiceIdentifier, ServiceRegistry, type ServiceToken, TOOL_REGISTRY_SERVICE, TOOL_SESSION_SERVICE, type ToolCommandBindings, type ToolContribution, type ToolInteraction, ToolRegistryService, type ToolSessionLeavePolicy, ToolSessionService, type ViewContribution, WORKBENCH_SERVICE, WorkbenchService, createServiceToken, isServiceToken };