@hachej/boring-workspace 0.1.16 → 0.1.18

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 (38) hide show
  1. package/README.md +36 -34
  2. package/dist/{FileTree-Dl-qUAB0.js → FileTree-DHVB9rpk.js} +15 -15
  3. package/dist/MarkdownEditor-L1KDH0bM.js +534 -0
  4. package/dist/{WorkspaceLoadingState-CSZfENWe.js → WorkspaceLoadingState-DYDxUYnx.js} +114 -110
  5. package/dist/WorkspaceProvider-CDPaAO5u.js +5971 -0
  6. package/dist/app-front.d.ts +94 -107
  7. package/dist/app-front.js +243 -233
  8. package/dist/app-server.d.ts +130 -15
  9. package/dist/app-server.js +1569 -304
  10. package/dist/{bootstrapServer-BreQ9QBc.d.ts → createInMemoryBridge-BDxDzihm.d.ts} +11 -26
  11. package/dist/manifest-CyNNdfYz.d.ts +58 -0
  12. package/dist/plugin.d.ts +199 -0
  13. package/dist/plugin.js +300 -0
  14. package/dist/server.d.ts +239 -4
  15. package/dist/server.js +901 -78
  16. package/dist/shared.d.ts +4 -112
  17. package/dist/surface-COYagY2m.d.ts +111 -0
  18. package/dist/testing.d.ts +19 -1
  19. package/dist/testing.js +2 -2
  20. package/dist/{agent-tool-DEtfQPVB.d.ts → ui-bridge-Gfh1MMgl.d.ts} +30 -30
  21. package/dist/workspace.css +36 -0
  22. package/dist/workspace.d.ts +165 -120
  23. package/dist/workspace.js +330 -377
  24. package/docs/INTERFACES.md +9 -9
  25. package/docs/PLUGIN_STRUCTURE.md +39 -145
  26. package/docs/PLUGIN_SYSTEM.md +355 -0
  27. package/docs/README.md +6 -1
  28. package/docs/plans/README.md +1 -0
  29. package/docs/plans/archive/HOT_RELOADABLE_AGENT_PLUGINS_PLAN.md +218 -0
  30. package/docs/plans/archive/RELOAD_PLUGGABILITY_PLAN.md +174 -0
  31. package/docs/plans/archive/UNIFIED_PLUGIN_SYSTEM_PLAN.md +769 -0
  32. package/package.json +11 -5
  33. package/dist/CommandPalette-NOEOVkN2.js +0 -5714
  34. package/dist/MarkdownEditor-yc6mFsnI.js +0 -533
  35. package/docs/bridge.md +0 -135
  36. package/docs/panels.md +0 -102
  37. package/docs/plugins.md +0 -158
  38. /package/docs/plans/{MACRO_PLUGIN_GENERIC_HELPERS_AUDIT.md → archive/MACRO_PLUGIN_GENERIC_HELPERS_AUDIT.md} +0 -0
@@ -5,33 +5,84 @@ import { JSX } from 'react/jsx-runtime';
5
5
  import { ReactNode } from 'react';
6
6
  import { SlashCommand } from '@hachej/boring-agent/front';
7
7
 
8
+ declare interface BoringFrontAPI {
9
+ registerProvider(registration: BoringFrontProviderRegistration): void;
10
+ registerBinding(registration: BoringFrontBindingRegistration): void;
11
+ registerCatalog(registration: CatalogConfig): void;
12
+ registerPanel<T = unknown>(registration: BoringFrontPanelRegistration<T>): void;
13
+ registerPanelCommand(registration: BoringFrontPanelCommandRegistration): void;
14
+ registerLeftTab<T = LeftTabParams>(registration: BoringFrontLeftTabRegistration<T>): void;
15
+ registerSurfaceResolver(registration: BoringFrontSurfaceResolverRegistration): void;
16
+ }
17
+
18
+ declare interface BoringFrontBindingRegistration {
19
+ id: string;
20
+ component: PluginBinding;
21
+ }
22
+
23
+ declare type BoringFrontFactory = (api: BoringFrontAPI) => void | Promise<void>;
24
+
8
25
  /**
9
- * Structural tool contract accepted from workspace plugins and UI tool
10
- * factories. Kept agent-runtime-neutral so only the app integration layer
11
- * needs to import @hachej/boring-agent.
26
+ * A `BoringFrontFactory` that carries its own plugin id (and optional
27
+ * label) as static properties. Produced by `definePlugin({ ... })` and used
28
+ * directly by `WorkspaceProvider.plugins`.
12
29
  */
13
- declare interface AgentTool {
14
- name: string;
15
- description: string;
16
- promptSnippet?: string;
17
- parameters: JSONSchema;
18
- execute(params: Record<string, unknown>, ctx: ToolExecContext): Promise<ToolResult>;
30
+ declare type BoringFrontFactoryWithId = BoringFrontFactory & {
31
+ pluginId: string;
32
+ pluginLabel?: string;
33
+ };
34
+
35
+ declare interface BoringFrontLeftTabRegistration<T = LeftTabParams> {
36
+ id: string;
37
+ title: string;
38
+ panelId: string;
39
+ icon?: ComponentType<{
40
+ className?: string;
41
+ }>;
42
+ component?: PanelConfig<T>["component"];
43
+ lazy?: boolean;
44
+ chromeless?: boolean;
45
+ requiresCapabilities?: string[];
46
+ source?: string;
19
47
  }
20
48
 
21
- declare interface AgentToolOutput {
22
- /**
23
- * @deprecated Executable agent tools should be contributed by server
24
- * plugins. This output remains for migration only.
25
- */
26
- type: "agent-tool";
49
+ declare interface BoringFrontPanelCommandRegistration {
50
+ id: string;
51
+ title: string;
52
+ panelId?: string;
53
+ run?: () => void;
54
+ keywords?: string[];
55
+ shortcut?: string;
56
+ when?: () => boolean;
57
+ }
58
+
59
+ declare interface BoringFrontPanelRegistration<T = unknown> {
27
60
  id: string;
28
- tool: AgentTool;
61
+ component: ComponentType<PaneProps<T>> | (() => Promise<{
62
+ default: ComponentType<PaneProps<T>>;
63
+ }>);
64
+ label?: string;
65
+ icon?: ComponentType<{
66
+ className?: string;
67
+ }>;
68
+ placement?: string;
69
+ requiresCapabilities?: string[];
70
+ essential?: boolean;
71
+ lazy?: boolean;
72
+ chromeless?: boolean;
73
+ source?: string;
29
74
  }
30
75
 
31
- declare interface BindingOutput {
32
- type: "binding";
76
+ declare interface BoringFrontProviderRegistration {
33
77
  id: string;
34
- component: PluginBinding;
78
+ component: PluginProvider;
79
+ }
80
+
81
+ declare interface BoringFrontSurfaceResolverRegistration {
82
+ id?: string;
83
+ kind: string;
84
+ source?: string;
85
+ resolve: (request: SurfaceOpenRequest) => SurfacePanelResolution | null | undefined;
35
86
  }
36
87
 
37
88
  declare type CatalogAdapter = {
@@ -65,11 +116,6 @@ declare type CatalogFacetValue = {
65
116
  count: number;
66
117
  };
67
118
 
68
- declare interface CatalogOutput {
69
- type: "catalog";
70
- catalog: CatalogConfig;
71
- }
72
-
73
119
  declare type CatalogRow = {
74
120
  id: string;
75
121
  title: string;
@@ -124,11 +170,6 @@ declare interface CommandConfig {
124
170
  pluginId?: string;
125
171
  }
126
172
 
127
- declare interface CommandOutput {
128
- type: "command";
129
- command: CommandConfig;
130
- }
131
-
132
173
  export declare function createLocalStorageSessions(opts?: CreateLocalStorageSessionsOptions): WorkspaceLocalSessionsStore;
133
174
 
134
175
  export declare interface CreateLocalStorageSessionsOptions {
@@ -136,19 +177,7 @@ export declare interface CreateLocalStorageSessionsOptions {
136
177
  initial?: () => WorkspaceLocalSessionsState;
137
178
  }
138
179
 
139
- declare type JSONSchema = Record<string, unknown>;
140
-
141
- declare interface LeftTabOutput<T = LeftTabParams> {
142
- type: "left-tab";
143
- id: string;
144
- title: string;
145
- icon?: PanelConfig<T>["icon"];
146
- component: PanelConfig<T>["component"];
147
- lazy?: PanelConfig<T>["lazy"];
148
- requiresCapabilities?: PanelConfig<T>["requiresCapabilities"];
149
- source?: PanelConfig<T>["source"];
150
- chromeless?: PanelConfig<T>["chromeless"];
151
- }
180
+ declare type FrontPluginHotReloadMode = "vite" | false;
152
181
 
153
182
  declare interface LeftTabParams {
154
183
  rootDir?: string;
@@ -196,11 +225,6 @@ declare interface PanelConfig<T = any> {
196
225
  }>);
197
226
  }
198
227
 
199
- declare interface PanelOutput<T = any> {
200
- type: "panel";
201
- panel: PanelConfig<T>;
202
- }
203
-
204
228
  /**
205
229
  * Unified prop shape for panel components rendered inside DockviewShell.
206
230
  *
@@ -231,8 +255,6 @@ declare interface PaneProps<T = unknown> {
231
255
 
232
256
  declare type PluginBinding = ComponentType<unknown>;
233
257
 
234
- declare type PluginOutput = LeftTabOutput | PanelOutput | CommandOutput | CatalogOutput | BindingOutput | ProviderOutput | SurfaceResolverOutput | AgentToolOutput;
235
-
236
258
  declare type PluginProvider = ComponentType<PluginProviderProps>;
237
259
 
238
260
  declare interface PluginProviderProps {
@@ -243,12 +265,6 @@ declare interface PluginProviderProps {
243
265
  children: ReactNode;
244
266
  }
245
267
 
246
- declare interface ProviderOutput {
247
- type: "provider";
248
- id: string;
249
- component: PluginProvider;
250
- }
251
-
252
268
  declare interface SessionItem {
253
269
  id: string;
254
270
  title: string;
@@ -269,18 +285,6 @@ declare interface SurfacePanelResolution {
269
285
  score?: number;
270
286
  }
271
287
 
272
- declare interface SurfaceResolverConfig {
273
- id: string;
274
- resolve: (request: SurfaceOpenRequest) => SurfacePanelResolution | undefined;
275
- source?: string;
276
- pluginId?: string;
277
- }
278
-
279
- declare interface SurfaceResolverOutput {
280
- type: "surface-resolver";
281
- resolver: SurfaceResolverConfig;
282
- }
283
-
284
288
  declare interface SurfaceShellApi {
285
289
  /** Open a file in the workbench. Idempotent — re-activates an existing pane for the same path. */
286
290
  openFile: (path: string) => void;
@@ -310,23 +314,6 @@ declare interface SurfaceShellTab {
310
314
  params?: Record<string, unknown>;
311
315
  }
312
316
 
313
- declare interface ToolExecContext {
314
- abortSignal: AbortSignal;
315
- toolCallId: string;
316
- onUpdate?: (partial: string) => void;
317
- /** Agent chat/session id executing this tool, when known. */
318
- sessionId?: string;
319
- }
320
-
321
- declare interface ToolResult {
322
- content: Array<{
323
- type: "text";
324
- text: string;
325
- }>;
326
- isError?: boolean;
327
- details?: unknown;
328
- }
329
-
330
317
  export declare function useLocalStorageSessions(store: WorkspaceLocalSessionsStore): WorkspaceLocalSessionsState;
331
318
 
332
319
  export declare type UseWorkspaceAgentSessions<TSession extends WorkspaceAgentSession = WorkspaceAgentSession> = (options: {
@@ -334,7 +321,7 @@ export declare type UseWorkspaceAgentSessions<TSession extends WorkspaceAgentSes
334
321
  storageKey: string;
335
322
  }) => WorkspaceAgentSessionsApi<TSession>;
336
323
 
337
- export declare function WorkspaceAgentFront<TSession extends WorkspaceAgentSession = WorkspaceAgentSession>({ workspaceId, chatPanel: chatPanelProp, useSessions: useSessionsProp, requestHeaders, sessionStorageKey, providerStorageKey, surfaceStorageKey, beforeShell, afterShell, panels, commands, catalogs, plugins, excludeDefaults, capabilities, apiBaseUrl, authHeaders, apiTimeout, defaultTheme, onThemeChange, persistenceEnabled, bridgeEndpoint, onAuthError, sessions, activeSessionId, onSwitchSession, onCreateSession, onDeleteSession, onActiveSessionIdChange, appTitle, defaultSessionTitle, topBarLeft, topBarRight, chatParams, extraPanels, extraCommands, onOpenNav, onOpenSurface, className, }: WorkspaceAgentFrontProps<TSession>): JSX.Element;
324
+ export declare function WorkspaceAgentFront<TSession extends WorkspaceAgentSession = WorkspaceAgentSession>({ workspaceId, chatPanel: chatPanelProp, useSessions: useSessionsProp, requestHeaders, sessionStorageKey, providerStorageKey, surfaceStorageKey, beforeShell, afterShell, panels, commands, catalogs, plugins, excludeDefaults, capabilities, apiBaseUrl, authHeaders, apiTimeout, defaultTheme, onThemeChange, persistenceEnabled, bridgeEndpoint, onAuthError, sessions, activeSessionId, onSwitchSession, onCreateSession, onDeleteSession, onActiveSessionIdChange, appTitle, defaultSessionTitle, defaultSurfaceOpen, defaultWorkbenchLeftTab, topBarLeft, topBarRight, chatParams, hotReloadEnabled, frontPluginHotReload, extraPanels, extraCommands, onOpenNav, onOpenSurface, className, }: WorkspaceAgentFrontProps<TSession>): JSX.Element;
338
325
 
339
326
  export declare interface WorkspaceAgentFrontProps<TSession extends WorkspaceAgentSession = WorkspaceAgentSession> extends Omit<WorkspaceProviderProps, "children" | "workspaceId" | "storageKey" | "chatPanel">, Omit<ChatLayoutProps, "nav" | "navParams" | "center" | "centerParams" | "surface" | "surfaceParams" | "sidebar" | "sidebarParams" | "storageKey"> {
340
327
  workspaceId: string;
@@ -348,6 +335,8 @@ export declare interface WorkspaceAgentFrontProps<TSession extends WorkspaceAgen
348
335
  afterShell?: ReactNode;
349
336
  appTitle?: string;
350
337
  defaultSessionTitle?: string;
338
+ defaultSurfaceOpen?: boolean;
339
+ defaultWorkbenchLeftTab?: string;
351
340
  topBarLeft?: ReactNode;
352
341
  topBarRight?: ReactNode;
353
342
  sessions?: Array<{
@@ -361,6 +350,13 @@ export declare interface WorkspaceAgentFrontProps<TSession extends WorkspaceAgen
361
350
  onDeleteSession?: (id: string) => void;
362
351
  onActiveSessionIdChange?: (sessionId: string) => void;
363
352
  chatParams?: Record<string, unknown>;
353
+ /**
354
+ * Forward to ChatPanel — when `false`, the `/reload` slash command is
355
+ * hidden and the PluginUpdateStatus banner above the composer is
356
+ * suppressed. Production apps that don't ship live plugin editing
357
+ * should pass `false`. Defaults to `true` (dev/playground default).
358
+ */
359
+ hotReloadEnabled?: boolean;
364
360
  extraPanels?: string[];
365
361
  extraCommands?: SlashCommand[];
366
362
  }
@@ -437,27 +433,6 @@ declare interface WorkspaceChatPanelProps {
437
433
  [key: string]: unknown;
438
434
  }
439
435
 
440
- declare interface WorkspaceFrontPlugin {
441
- id: string;
442
- label?: string;
443
- /**
444
- * Context prepended to the agent's system prompt at boot. Concatenated
445
- * across all registered plugins (in registration order) and joined with
446
- * double-newlines. Plain Markdown. ~200-500 chars recommended.
447
- */
448
- systemPrompt?: string;
449
- panels?: PanelConfig[];
450
- commands?: CommandConfig[];
451
- catalogs?: CatalogConfig[];
452
- bindings?: PluginBinding[];
453
- /**
454
- * @deprecated Executable agent tools should be contributed by server
455
- * plugins. This field remains for migration only.
456
- */
457
- agentTools?: AgentTool[];
458
- outputs?: PluginOutput[];
459
- }
460
-
461
436
  export declare interface WorkspaceLocalSessionsState {
462
437
  sessions: SessionItem[];
463
438
  activeId: string;
@@ -474,7 +449,11 @@ export declare interface WorkspaceLocalSessionsStore {
474
449
  declare interface WorkspaceProviderProps {
475
450
  children: ReactNode;
476
451
  chatPanel?: WorkspaceChatPanelComponent;
477
- plugins?: WorkspaceFrontPlugin[];
452
+ /**
453
+ * Front plugin entries produced by `definePlugin({ id, ... })` from
454
+ * `@hachej/boring-workspace/plugin`.
455
+ */
456
+ plugins?: BoringFrontFactoryWithId[];
478
457
  excludeDefaults?: string[];
479
458
  panels?: PanelConfig[];
480
459
  commands?: CommandConfig[];
@@ -492,6 +471,14 @@ declare interface WorkspaceProviderProps {
492
471
  bridgeEndpoint?: string | null;
493
472
  onAuthError?: (statusCode: number) => void;
494
473
  onOpenFile?: (path: string) => void;
474
+ debug?: boolean;
475
+ /**
476
+ * Hot-load dynamically discovered front plugin modules. The current
477
+ * implementation relies on Vite's /@fs transform endpoint, so it defaults to
478
+ * dev-only. Production hosts should keep this false until they provide their
479
+ * own module asset endpoint.
480
+ */
481
+ frontPluginHotReload?: FrontPluginHotReloadMode;
495
482
  }
496
483
 
497
484
  export { }