@openforge-app/plugin-sdk 0.1.0 → 0.2.3

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 (97) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -0
  3. package/dist/browserSurfaces.d.ts +78 -0
  4. package/dist/browserSurfaces.js +17 -0
  5. package/dist/browserSurfacesTesting.d.ts +60 -0
  6. package/dist/browserSurfacesTesting.js +240 -0
  7. package/dist/domain.d.ts +74 -15
  8. package/dist/domain.js +5 -1
  9. package/dist/fileIcons.d.ts +6 -0
  10. package/dist/fileIcons.js +84 -0
  11. package/dist/frontend.d.ts +5 -2
  12. package/dist/frontend.js +1 -0
  13. package/dist/index.d.ts +5 -3
  14. package/dist/index.js +2 -1
  15. package/dist/manifest.d.ts +29 -0
  16. package/dist/manifest.js +37 -0
  17. package/dist/markdown.d.ts +5 -1
  18. package/dist/markdown.js +67 -18
  19. package/dist/openforgePackageMetadataSchema.json +40 -1
  20. package/dist/pluginIcons.d.ts +7 -0
  21. package/dist/pluginIcons.js +104 -0
  22. package/dist/publicUiExports.d.mts +16 -0
  23. package/dist/publicUiExports.mjs +59 -0
  24. package/dist/svelteHostRuntimeContract.d.mts +1 -0
  25. package/dist/svelteHostRuntimeContract.mjs +16 -0
  26. package/dist/testing/backendServicesFake.d.ts +19 -0
  27. package/dist/testing/backendServicesFake.js +87 -0
  28. package/dist/testing/commonApiFake.d.ts +22 -0
  29. package/dist/testing/commonApiFake.js +274 -0
  30. package/dist/testing/contracts.d.ts +231 -0
  31. package/dist/testing/contracts.js +1 -0
  32. package/dist/testing/frontendContributionFake.d.ts +36 -0
  33. package/dist/testing/frontendContributionFake.js +195 -0
  34. package/dist/testing/registryFake.d.ts +40 -0
  35. package/dist/testing/registryFake.js +124 -0
  36. package/dist/testing/support.d.ts +40 -0
  37. package/dist/testing/support.js +242 -0
  38. package/dist/testing.d.ts +3 -223
  39. package/dist/testing.js +2 -625
  40. package/dist/types.d.ts +193 -7
  41. package/dist/types.js +8 -0
  42. package/dist/ui/Button.svelte +49 -0
  43. package/dist/ui/Checkbox.svelte +137 -0
  44. package/dist/ui/FileTypeIcon.svelte +37 -0
  45. package/dist/ui/MarkdownContent.svelte +71 -11
  46. package/dist/ui/Modal.svelte +157 -0
  47. package/dist/ui/PluginPageHeader.svelte +26 -0
  48. package/dist/ui/PluginViewState.svelte +76 -0
  49. package/dist/ui/ResizablePanel.svelte +10 -0
  50. package/dist/ui/icons/README.md +9 -0
  51. package/dist/ui/icons/c.svg +1 -0
  52. package/dist/ui/icons/console.svg +1 -0
  53. package/dist/ui/icons/cpp.svg +1 -0
  54. package/dist/ui/icons/csharp.svg +1 -0
  55. package/dist/ui/icons/css.svg +3 -0
  56. package/dist/ui/icons/database.svg +1 -0
  57. package/dist/ui/icons/docker.svg +1 -0
  58. package/dist/ui/icons/document.svg +4 -0
  59. package/dist/ui/icons/file.svg +1 -0
  60. package/dist/ui/icons/folder-open.svg +1 -0
  61. package/dist/ui/icons/folder.svg +1 -0
  62. package/dist/ui/icons/git.svg +3 -0
  63. package/dist/ui/icons/go.svg +1 -0
  64. package/dist/ui/icons/graphql.svg +20 -0
  65. package/dist/ui/icons/h.svg +3 -0
  66. package/dist/ui/icons/html.svg +3 -0
  67. package/dist/ui/icons/image.svg +3 -0
  68. package/dist/ui/icons/java.svg +6 -0
  69. package/dist/ui/icons/javascript.svg +3 -0
  70. package/dist/ui/icons/json.svg +3 -0
  71. package/dist/ui/icons/kotlin.svg +1 -0
  72. package/dist/ui/icons/lock.svg +3 -0
  73. package/dist/ui/icons/markdown.svg +6 -0
  74. package/dist/ui/icons/nodejs.svg +6 -0
  75. package/dist/ui/icons/npm.svg +3 -0
  76. package/dist/ui/icons/pdf.svg +1 -0
  77. package/dist/ui/icons/php.svg +1 -0
  78. package/dist/ui/icons/python.svg +1 -0
  79. package/dist/ui/icons/react.svg +8 -0
  80. package/dist/ui/icons/react_ts.svg +8 -0
  81. package/dist/ui/icons/readme.svg +4 -0
  82. package/dist/ui/icons/ruby.svg +1 -0
  83. package/dist/ui/icons/rust.svg +1 -0
  84. package/dist/ui/icons/sass.svg +3 -0
  85. package/dist/ui/icons/settings.svg +4 -0
  86. package/dist/ui/icons/svelte.svg +1 -0
  87. package/dist/ui/icons/svg.svg +3 -0
  88. package/dist/ui/icons/swift.svg +1 -0
  89. package/dist/ui/icons/tune.svg +11 -0
  90. package/dist/ui/icons/typescript-def.svg +6 -0
  91. package/dist/ui/icons/typescript.svg +3 -0
  92. package/dist/ui/icons/vue.svg +1 -0
  93. package/dist/ui/icons/xml.svg +1 -0
  94. package/dist/ui/icons/yaml.svg +3 -0
  95. package/dist/ui/icons/zip.svg +3 -0
  96. package/dist/vite.js +5 -2
  97. package/package.json +34 -7
package/dist/testing.d.ts CHANGED
@@ -1,223 +1,3 @@
1
- import type { BackendMethodRegistration, BackendOpenForgeAPI, BackendPlugin, BackendPluginContext, BackgroundServiceRegistration, CommandRegistration, CommandShortcutMetadata, ConfigureStartPromptContributionRequest, CreateTaskRequest, Disposable, FrontendOpenForgeAPI, FrontendPlugin, FrontendPluginContext, JsonValue, NotificationRequest, OpenForgeNavigationRequest, OpenForgePackageMetadata, PluginSettingsSectionRegistration, PluginStorage, PluginTaskPaneTabRegistration, StartTaskImplementationRequest, PluginViewRegistration, SubscriptionSink } from './types';
2
- export type TestingRuntimeScope = 'global' | 'project' | 'task';
3
- export type TestingRuntimeKind = 'commands' | 'events' | 'views' | 'taskPane' | 'settings' | 'backend' | 'background';
4
- type MaybePromise<T> = T | Promise<T>;
5
- type CommandHandler = (payload?: unknown) => MaybePromise<unknown>;
6
- type EventHandler = (payload: unknown) => void;
7
- export interface TestingOpenForgeApiOptions {
8
- pluginId?: string;
9
- projectId?: string | null;
10
- taskId?: string | null;
11
- /** The active view key reported by `navigation.get().currentView`. Defaults to `'board'`. */
12
- viewId?: string;
13
- packageMetadata?: OpenForgePackageMetadata;
14
- storage?: PluginStorage;
15
- }
16
- export interface TestingOpenForgeApiCalls {
17
- commandInvocations: Array<{
18
- id: string;
19
- qualifiedId: string;
20
- payload: unknown;
21
- }>;
22
- globalCommandInvocations: Array<{
23
- qualifiedId: string;
24
- payload: unknown;
25
- }>;
26
- backendInvocations: Array<{
27
- method: string;
28
- qualifiedId: string;
29
- payload: unknown;
30
- }>;
31
- emittedEvents: Array<{
32
- event: string;
33
- qualifiedEvent: string;
34
- payload: unknown;
35
- }>;
36
- emittedGlobalEvents: Array<{
37
- qualifiedEvent: string;
38
- payload: unknown;
39
- }>;
40
- openUrl: string[];
41
- navigationRequests: OpenForgeNavigationRequest[];
42
- notify: NotificationRequest[];
43
- taskCreations: CreateTaskRequest[];
44
- startPromptContributionConfigurations: ConfigureStartPromptContributionRequest[];
45
- taskImplementationStarts: StartTaskImplementationRequest[];
46
- taskSummaryUpdates: Array<{
47
- taskId: string;
48
- summary: string;
49
- }>;
50
- taskStatusUpdates: Array<{
51
- taskId: string;
52
- status: string;
53
- }>;
54
- configWrites: Array<{
55
- key: string;
56
- value: JsonValue;
57
- projectId: string | null;
58
- }>;
59
- fsWrites: Array<{
60
- projectId: string;
61
- path: string;
62
- content: string;
63
- }>;
64
- shellSpawns: Array<{
65
- taskId: string;
66
- cwd: string;
67
- cols: number;
68
- rows: number;
69
- terminalIndex: number;
70
- }>;
71
- shellWrites: Array<{
72
- taskId: string;
73
- terminalIndex: number;
74
- data: string;
75
- }>;
76
- shellResizes: Array<{
77
- taskId: string;
78
- terminalIndex: number;
79
- cols: number;
80
- rows: number;
81
- }>;
82
- shellKills: Array<{
83
- taskId: string;
84
- terminalIndex: number;
85
- }>;
86
- shellBuffers: Array<{
87
- taskId: string;
88
- terminalIndex: number;
89
- }>;
90
- storageGets: Array<{
91
- scope: TestingRuntimeScope;
92
- scopeId: string | null;
93
- key: string;
94
- }>;
95
- storageSets: Array<{
96
- scope: TestingRuntimeScope;
97
- scopeId: string | null;
98
- key: string;
99
- value: JsonValue;
100
- }>;
101
- storageDeletes: Array<{
102
- scope: TestingRuntimeScope;
103
- scopeId: string | null;
104
- key: string;
105
- }>;
106
- }
107
- export interface TestingContributionBase {
108
- id: string;
109
- qualifiedId: string;
110
- pluginId: string;
111
- projectId: string | null;
112
- }
113
- export type TestingCommandContribution = TestingContributionBase & CommandRegistration & {
114
- title: string;
115
- icon?: string;
116
- shortcut?: CommandShortcutMetadata;
117
- handler: CommandHandler;
118
- };
119
- export type TestingEventListenerContribution = TestingContributionBase & {
120
- handler: EventHandler;
121
- global: boolean;
122
- };
123
- export type TestingViewContribution = TestingContributionBase & PluginViewRegistration;
124
- export type TestingTaskPaneTabContribution = TestingContributionBase & PluginTaskPaneTabRegistration;
125
- export type TestingSettingsSectionContribution = TestingContributionBase & PluginSettingsSectionRegistration;
126
- export type TestingBackendMethodContribution = TestingContributionBase & {
127
- registration: BackendMethodRegistration;
128
- };
129
- export type TestingBackgroundServiceContribution = TestingContributionBase & BackgroundServiceRegistration & {
130
- started: boolean;
131
- };
132
- export interface TestingOpenForgeRegistrySnapshot {
133
- pluginId: string;
134
- projectId: string | null;
135
- views: TestingViewContribution[];
136
- taskPaneTabs: TestingTaskPaneTabContribution[];
137
- settingsSections: TestingSettingsSectionContribution[];
138
- commands: TestingCommandContribution[];
139
- eventListeners: TestingEventListenerContribution[];
140
- backendMethods: TestingBackendMethodContribution[];
141
- backgroundServices: TestingBackgroundServiceContribution[];
142
- }
143
- export type MockFrontendOpenForgeAPI = FrontendOpenForgeAPI & {
144
- readonly __testing: {
145
- readonly calls: TestingOpenForgeApiCalls;
146
- readonly registry: TestingOpenForgeRegistryFake;
147
- };
148
- };
149
- export type MockBackendOpenForgeAPI = BackendOpenForgeAPI & {
150
- readonly __testing: {
151
- readonly calls: TestingOpenForgeApiCalls;
152
- readonly registry: TestingOpenForgeRegistryFake;
153
- };
154
- };
155
- export declare class TestingSubscriptionSink implements SubscriptionSink {
156
- readonly subscriptions: Disposable[];
157
- add(subscription: Disposable | (() => void)): void;
158
- disposeAll(): Promise<void>;
159
- }
160
- export declare class TestingOpenForgeRegistryFake {
161
- readonly pluginId: string;
162
- readonly projectId: string | null;
163
- readonly taskId: string | null;
164
- readonly viewId: string;
165
- readonly packageMetadata: OpenForgePackageMetadata;
166
- readonly calls: TestingOpenForgeApiCalls;
167
- readonly storage: PluginStorage;
168
- readonly frontendSubscriptions: TestingSubscriptionSink;
169
- readonly backendSubscriptions: TestingSubscriptionSink;
170
- private readonly commands;
171
- private readonly views;
172
- private readonly taskPaneTabs;
173
- private readonly settingsSections;
174
- private readonly eventListeners;
175
- private readonly eventHandlers;
176
- private readonly backendMethods;
177
- private readonly backgroundServices;
178
- private readonly claimedIds;
179
- private readonly config;
180
- private eventListenerSequence;
181
- private cachedFrontendApi;
182
- private cachedBackendApi;
183
- constructor(options?: TestingOpenForgeApiOptions);
184
- get frontendApi(): MockFrontendOpenForgeAPI;
185
- get backendApi(): MockBackendOpenForgeAPI;
186
- get snapshot(): TestingOpenForgeRegistrySnapshot;
187
- createFrontendApi(): MockFrontendOpenForgeAPI;
188
- createBackendApi(): MockBackendOpenForgeAPI;
189
- createFrontendContext(): FrontendPluginContext;
190
- createBackendContext(): BackendPluginContext;
191
- activateFrontend(plugin: FrontendPlugin): Promise<void>;
192
- activateBackend(plugin: BackendPlugin): Promise<void>;
193
- disposeAll(): Promise<void>;
194
- getSnapshot(): TestingOpenForgeRegistrySnapshot;
195
- private createContext;
196
- private startPromptContributions;
197
- private createCommonApi;
198
- private getContextSnapshot;
199
- private getNavigationSnapshot;
200
- private localQualifiedId;
201
- private claim;
202
- private release;
203
- private registerCommand;
204
- private registerView;
205
- private registerTaskPaneTab;
206
- private registerSettingsSection;
207
- private registerBackendMethod;
208
- private registerBackgroundService;
209
- private registerEventListener;
210
- private startBackgroundServices;
211
- private invokeCommand;
212
- private invokeGlobalCommand;
213
- private invokeBackend;
214
- private emitEvent;
215
- }
216
- export declare function createOpenForgeRegistryFake(options?: TestingOpenForgeApiOptions): TestingOpenForgeRegistryFake;
217
- export declare function createMockOpenForgeApi(options?: TestingOpenForgeApiOptions): MockFrontendOpenForgeAPI;
218
- export declare function createMockFrontendOpenForgeApi(options?: TestingOpenForgeApiOptions): MockFrontendOpenForgeAPI;
219
- export declare function createMockBackendOpenForgeApi(options?: TestingOpenForgeApiOptions): MockBackendOpenForgeAPI;
220
- export declare function createMockPluginContext(options?: TestingOpenForgeApiOptions): FrontendPluginContext;
221
- export declare function createMemoryPluginStorage(calls?: TestingOpenForgeApiCalls): PluginStorage;
222
- export declare function createTestingCalls(): TestingOpenForgeApiCalls;
223
- export {};
1
+ export { createMockBackendOpenForgeApi, createMockFrontendOpenForgeApi, createMockOpenForgeApi, createMockPluginContext, createOpenForgeRegistryFake, TestingOpenForgeRegistryFake, } from './testing/registryFake';
2
+ export { createMemoryPluginStorage, createTestingCalls, TestingSubscriptionSink, } from './testing/support';
3
+ export type { MockBackendOpenForgeAPI, MockFrontendOpenForgeAPI, TestingBackgroundServiceContribution, TestingBackendMethodContribution, TestingCommandContribution, TestingContributionBase, TestingEventListenerContribution, TestingInjectionPointContribution, TestingOpenForgeApiCalls, TestingOpenForgeApiOptions, TestingOpenForgeRegistrySnapshot, TestingRuntimeKind, TestingRuntimeScope, TestingSettingsSectionContribution, TestingTaskPaneTabContribution, TestingTaskUISectionContribution, TestingViewContribution, } from './testing/contracts';