@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 +12 -0
- package/dist/index.d.mts +196 -21
- package/dist/index.d.ts +196 -21
- package/dist/index.js +718 -157
- package/dist/index.mjs +707 -156
- package/package.json +1 -1
- package/src/command.ts +10 -10
- package/src/context.ts +22 -17
- package/src/contribution/index.ts +12 -12
- package/src/contribution/points.ts +27 -3
- package/src/contribution/registry.ts +118 -118
- package/src/disposable.ts +3 -3
- package/src/extension.ts +177 -164
- package/src/index.ts +338 -145
- package/src/run-test-full.ts +98 -98
- package/src/service.ts +191 -11
- package/src/services/CommandService.ts +79 -79
- package/src/services/ConfigurationService.ts +107 -107
- package/src/services/ToolRegistryService.ts +41 -0
- package/src/services/ToolSessionService.ts +213 -0
- package/src/services/WorkbenchService.ts +187 -8
- package/src/services/index.ts +23 -1
- package/src/services/tokens.ts +27 -0
- package/src/test-extension-full.ts +79 -79
package/src/services/index.ts
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
import CommandService from "./CommandService";
|
|
2
2
|
import ConfigurationService from "./ConfigurationService";
|
|
3
|
+
import ToolRegistryService from "./ToolRegistryService";
|
|
4
|
+
import ToolSessionService from "./ToolSessionService";
|
|
3
5
|
import WorkbenchService from "./WorkbenchService";
|
|
6
|
+
import {
|
|
7
|
+
COMMAND_SERVICE,
|
|
8
|
+
CONFIGURATION_SERVICE,
|
|
9
|
+
CORE_SERVICE_TOKENS,
|
|
10
|
+
TOOL_REGISTRY_SERVICE,
|
|
11
|
+
TOOL_SESSION_SERVICE,
|
|
12
|
+
WORKBENCH_SERVICE,
|
|
13
|
+
} from "./tokens";
|
|
4
14
|
|
|
5
|
-
export {
|
|
15
|
+
export {
|
|
16
|
+
CommandService,
|
|
17
|
+
ConfigurationService,
|
|
18
|
+
ToolRegistryService,
|
|
19
|
+
ToolSessionService,
|
|
20
|
+
WorkbenchService,
|
|
21
|
+
COMMAND_SERVICE,
|
|
22
|
+
CONFIGURATION_SERVICE,
|
|
23
|
+
TOOL_REGISTRY_SERVICE,
|
|
24
|
+
TOOL_SESSION_SERVICE,
|
|
25
|
+
WORKBENCH_SERVICE,
|
|
26
|
+
CORE_SERVICE_TOKENS,
|
|
27
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createServiceToken } from "../service";
|
|
2
|
+
import type CommandService from "./CommandService";
|
|
3
|
+
import type ConfigurationService from "./ConfigurationService";
|
|
4
|
+
import type ToolRegistryService from "./ToolRegistryService";
|
|
5
|
+
import type ToolSessionService from "./ToolSessionService";
|
|
6
|
+
import type WorkbenchService from "./WorkbenchService";
|
|
7
|
+
|
|
8
|
+
export const COMMAND_SERVICE = createServiceToken<CommandService>(
|
|
9
|
+
"CommandService",
|
|
10
|
+
);
|
|
11
|
+
export const CONFIGURATION_SERVICE = createServiceToken<ConfigurationService>(
|
|
12
|
+
"ConfigurationService",
|
|
13
|
+
);
|
|
14
|
+
export const TOOL_REGISTRY_SERVICE =
|
|
15
|
+
createServiceToken<ToolRegistryService>("ToolRegistryService");
|
|
16
|
+
export const TOOL_SESSION_SERVICE =
|
|
17
|
+
createServiceToken<ToolSessionService>("ToolSessionService");
|
|
18
|
+
export const WORKBENCH_SERVICE =
|
|
19
|
+
createServiceToken<WorkbenchService>("WorkbenchService");
|
|
20
|
+
|
|
21
|
+
export const CORE_SERVICE_TOKENS = {
|
|
22
|
+
COMMAND: COMMAND_SERVICE,
|
|
23
|
+
CONFIGURATION: CONFIGURATION_SERVICE,
|
|
24
|
+
TOOL_REGISTRY: TOOL_REGISTRY_SERVICE,
|
|
25
|
+
TOOL_SESSION: TOOL_SESSION_SERVICE,
|
|
26
|
+
WORKBENCH: WORKBENCH_SERVICE,
|
|
27
|
+
} as const;
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { ExtensionContext } from "./context";
|
|
2
|
-
import {
|
|
3
|
-
ContributionPointIds,
|
|
4
|
-
CommandContribution,
|
|
5
|
-
ToolContribution,
|
|
6
|
-
ViewContribution,
|
|
7
|
-
} from "./contribution";
|
|
8
|
-
import { Extension } from "./extension";
|
|
9
|
-
import CommandService from "./services/CommandService";
|
|
10
|
-
|
|
11
|
-
export const fullExtension: Extension = {
|
|
12
|
-
id: "full-feature-test-extension",
|
|
13
|
-
metadata: {
|
|
14
|
-
name: "Full Feature Test Extension",
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
activate(context: ExtensionContext) {
|
|
18
|
-
console.log("Full Feature Test Extension activated!");
|
|
19
|
-
|
|
20
|
-
// Manually register a command (imperative way)
|
|
21
|
-
const commandService =
|
|
22
|
-
context.services.get<CommandService>("CommandService");
|
|
23
|
-
commandService!.registerCommand("test.imperative.hello", (name: string) => {
|
|
24
|
-
return `Hello Imperative ${name}`;
|
|
25
|
-
});
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
deactivate(context: ExtensionContext) {
|
|
29
|
-
console.log("Full Feature Test Extension deactivated!");
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
contribute() {
|
|
33
|
-
return {
|
|
34
|
-
// 1. Command Contributions
|
|
35
|
-
[ContributionPointIds.COMMANDS]: [
|
|
36
|
-
// Declarative command with handler (auto-registered by our updated ExtensionManager)
|
|
37
|
-
{
|
|
38
|
-
id: "test.declarative.auto",
|
|
39
|
-
command: "test.declarative.auto",
|
|
40
|
-
title: "Auto Registered Command",
|
|
41
|
-
handler: () => {
|
|
42
|
-
return "Auto Registered Result";
|
|
43
|
-
},
|
|
44
|
-
} as CommandContribution,
|
|
45
|
-
|
|
46
|
-
// Declarative command without handler (just definition, maybe handled elsewhere)
|
|
47
|
-
{
|
|
48
|
-
id: "test.declarative.no-handler",
|
|
49
|
-
command: "test.declarative.no-handler",
|
|
50
|
-
title: "No Handler Command",
|
|
51
|
-
} as CommandContribution,
|
|
52
|
-
],
|
|
53
|
-
|
|
54
|
-
// 2. Tool Contributions
|
|
55
|
-
[ContributionPointIds.TOOLS]: [
|
|
56
|
-
{
|
|
57
|
-
id: "test.tool.calculator",
|
|
58
|
-
name: "Calculator",
|
|
59
|
-
description: "Simple calculator",
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
} as ToolContribution,
|
|
65
|
-
],
|
|
66
|
-
|
|
67
|
-
// 3. View Contributions
|
|
68
|
-
[ContributionPointIds.VIEWS]: [
|
|
69
|
-
{
|
|
70
|
-
id: "test.view.sidebar",
|
|
71
|
-
name: "Test Sidebar",
|
|
72
|
-
type: "sidebar",
|
|
73
|
-
component: "SidebarComponent", // Mock component string
|
|
74
|
-
location: "left",
|
|
75
|
-
} as ViewContribution,
|
|
76
|
-
],
|
|
77
|
-
};
|
|
78
|
-
},
|
|
79
|
-
};
|
|
1
|
+
import { ExtensionContext } from "./context";
|
|
2
|
+
import {
|
|
3
|
+
ContributionPointIds,
|
|
4
|
+
CommandContribution,
|
|
5
|
+
ToolContribution,
|
|
6
|
+
ViewContribution,
|
|
7
|
+
} from "./contribution";
|
|
8
|
+
import { Extension } from "./extension";
|
|
9
|
+
import CommandService from "./services/CommandService";
|
|
10
|
+
|
|
11
|
+
export const fullExtension: Extension = {
|
|
12
|
+
id: "full-feature-test-extension",
|
|
13
|
+
metadata: {
|
|
14
|
+
name: "Full Feature Test Extension",
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
activate(context: ExtensionContext) {
|
|
18
|
+
console.log("Full Feature Test Extension activated!");
|
|
19
|
+
|
|
20
|
+
// Manually register a command (imperative way)
|
|
21
|
+
const commandService =
|
|
22
|
+
context.services.get<CommandService>("CommandService");
|
|
23
|
+
commandService!.registerCommand("test.imperative.hello", (name: string) => {
|
|
24
|
+
return `Hello Imperative ${name}`;
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
deactivate(context: ExtensionContext) {
|
|
29
|
+
console.log("Full Feature Test Extension deactivated!");
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
contribute() {
|
|
33
|
+
return {
|
|
34
|
+
// 1. Command Contributions
|
|
35
|
+
[ContributionPointIds.COMMANDS]: [
|
|
36
|
+
// Declarative command with handler (auto-registered by our updated ExtensionManager)
|
|
37
|
+
{
|
|
38
|
+
id: "test.declarative.auto",
|
|
39
|
+
command: "test.declarative.auto",
|
|
40
|
+
title: "Auto Registered Command",
|
|
41
|
+
handler: () => {
|
|
42
|
+
return "Auto Registered Result";
|
|
43
|
+
},
|
|
44
|
+
} as CommandContribution,
|
|
45
|
+
|
|
46
|
+
// Declarative command without handler (just definition, maybe handled elsewhere)
|
|
47
|
+
{
|
|
48
|
+
id: "test.declarative.no-handler",
|
|
49
|
+
command: "test.declarative.no-handler",
|
|
50
|
+
title: "No Handler Command",
|
|
51
|
+
} as CommandContribution,
|
|
52
|
+
],
|
|
53
|
+
|
|
54
|
+
// 2. Tool Contributions
|
|
55
|
+
[ContributionPointIds.TOOLS]: [
|
|
56
|
+
{
|
|
57
|
+
id: "test.tool.calculator",
|
|
58
|
+
name: "Calculator",
|
|
59
|
+
description: "Simple calculator",
|
|
60
|
+
interaction: "instant",
|
|
61
|
+
commands: {
|
|
62
|
+
execute: "test.declarative.auto",
|
|
63
|
+
},
|
|
64
|
+
} as ToolContribution,
|
|
65
|
+
],
|
|
66
|
+
|
|
67
|
+
// 3. View Contributions
|
|
68
|
+
[ContributionPointIds.VIEWS]: [
|
|
69
|
+
{
|
|
70
|
+
id: "test.view.sidebar",
|
|
71
|
+
name: "Test Sidebar",
|
|
72
|
+
type: "sidebar",
|
|
73
|
+
component: "SidebarComponent", // Mock component string
|
|
74
|
+
location: "left",
|
|
75
|
+
} as ViewContribution,
|
|
76
|
+
],
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
};
|