@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
@@ -1,9 +1,44 @@
1
- import { PiPackageSource, CreateAgentAppOptions } from '@hachej/boring-agent/server';
1
+ import { PiPackageSource, PiExtensionFactory, CreateAgentAppOptions } from '@hachej/boring-agent/server';
2
2
  export { PiPackageSource as WorkspacePiPackageSource } from '@hachej/boring-agent/server';
3
3
  import { FastifyInstance } from 'fastify';
4
- import { S as ServerBootstrapOptions, c as createInMemoryBridge, W as WorkspaceServerPlugin, a as WorkspaceProvisioningContribution, b as WorkspaceRouteContribution } from './bootstrapServer-BreQ9QBc.js';
5
- export { C as ComposeServerPluginsOptions, d as composeServerPlugins, e as defineServerPlugin } from './bootstrapServer-BreQ9QBc.js';
6
- import './agent-tool-DEtfQPVB.js';
4
+ import { W as WorkspaceServerPlugin, S as ServerBootstrapOptions, a as WorkspaceProvisioningContribution, b as WorkspaceRouteContribution, c as createInMemoryBridge } from './createInMemoryBridge-BDxDzihm.js';
5
+ import './ui-bridge-Gfh1MMgl.js';
6
+
7
+ /**
8
+ * Directory-source entry: `{ dir, options?, hotReload? }`. Resolved via
9
+ * jiti when `hotReload: true`, native `import()` otherwise.
10
+ */
11
+ interface DirPluginEntry {
12
+ dir: string;
13
+ options?: unknown;
14
+ hotReload?: boolean;
15
+ }
16
+ /**
17
+ * Context the resolver hands to plugin factories. Same shape as the
18
+ * top-level `WorkspaceAgentServerPluginContext` (workspaceRoot + bridge)
19
+ * — keeping a single name here would create a circular type import,
20
+ * but the structural type is identical and callers cast between them.
21
+ */
22
+ interface PluginResolveContext {
23
+ workspaceRoot: string;
24
+ bridge: unknown;
25
+ }
26
+ /**
27
+ * Returns true when a directory-source package has an importable server entry.
28
+ * Missing package.json, unsafe explicit entries, and declared-but-missing
29
+ * entries still throw — only the legitimate "front/Pi-only package" case
30
+ * (no manifest server) returns false.
31
+ */
32
+ declare function hasDirServerPlugin(entry: DirPluginEntry): boolean;
33
+ /**
34
+ * Single dispatch point for any entry shape:
35
+ * - WorkspaceServerPlugin object → pass through
36
+ * - DirPluginEntry → jiti/import + factory
37
+ *
38
+ * Used by both initial install (createWorkspaceAgentServer) and rebuild
39
+ * (rebuildServerPlugins) so the dispatch lives in one place.
40
+ */
41
+ declare function resolveOnePluginEntry<TPlugin extends WorkspaceServerPlugin>(entry: unknown, ctx: PluginResolveContext): Promise<TPlugin>;
7
42
 
8
43
  /**
9
44
  * Standalone workspace + agent Fastify composition.
@@ -12,39 +47,99 @@ import './agent-tool-DEtfQPVB.js';
12
47
  * workspace entrypoints must not.
13
48
  */
14
49
 
15
- interface WorkspaceAgentResourceLoaderOptions {
50
+ type HostExtensionFactory = PiExtensionFactory;
51
+ interface WorkspaceAgentPiOptions {
16
52
  noContextFiles?: boolean;
17
53
  noSkills?: boolean;
18
54
  additionalSkillPaths?: string[];
19
- piPackages?: PiPackageSource[];
55
+ packages?: PiPackageSource[];
56
+ extensionPaths?: string[];
57
+ extensionFactories?: HostExtensionFactory[];
20
58
  }
21
- type WorkspaceAgentCreateOptions = Omit<CreateAgentAppOptions, "resourceLoaderOptions"> & {
22
- resourceLoaderOptions?: WorkspaceAgentResourceLoaderOptions;
59
+ type WorkspaceAgentCreateOptions = Omit<CreateAgentAppOptions, "pi"> & {
60
+ pi?: WorkspaceAgentPiOptions;
23
61
  };
24
62
  interface WorkspaceAgentServerPluginContext {
25
63
  workspaceRoot: string;
26
64
  bridge: ReturnType<typeof createInMemoryBridge>;
27
65
  }
28
- type WorkspaceAgentServerPluginFactory = (context: WorkspaceAgentServerPluginContext) => WorkspaceServerPlugin;
29
- interface CreateWorkspaceAgentServerOptions extends WorkspaceAgentCreateOptions, Pick<ServerBootstrapOptions, "plugins" | "defaults" | "excludeDefaults"> {
30
- pluginFactories?: WorkspaceAgentServerPluginFactory[];
66
+ /**
67
+ * Single install entry type. Accepts:
68
+ * - `WorkspaceServerPlugin` — pre-built plugin object.
69
+ * - `{ dir, options?, hotReload? }` — directory-source plugin resolved
70
+ * via explicit package.json#boring.server. Declared-but-missing throws.
71
+ * hotReload uses jiti for diagnostic re-imports, while route/tool
72
+ * registration is still boot-time.
73
+ */
74
+ type WorkspacePluginEntry = WorkspaceServerPlugin | DirPluginEntry;
75
+ interface CreateWorkspaceAgentServerOptions extends WorkspaceAgentCreateOptions, Pick<ServerBootstrapOptions, "defaults" | "excludeDefaults"> {
76
+ /**
77
+ * Plugins to install. Accepts pre-built `WorkspaceServerPlugin` objects
78
+ * or `{ dir, options?, hotReload? }` directory-source entries.
79
+ */
80
+ plugins?: WorkspacePluginEntry[];
31
81
  provisionWorkspace?: boolean;
32
82
  workspaceProvisioning?: {
33
83
  force?: boolean;
34
84
  };
35
85
  validateUiPaths?: boolean;
86
+ /**
87
+ * Whether live plugin reload endpoints refresh discovered package plugins.
88
+ * When true, chat `/reload` refreshes package front/Pi metadata and reports
89
+ * static-server restart warnings; dir-source server entries are re-imported
90
+ * for diagnostics only. When false, initial static discovery still runs, but
91
+ * dynamic Pi/system-prompt refresh and `POST /api/boring.reload` are disabled.
92
+ * Defaults to true.
93
+ */
94
+ pluginHotReload?: boolean;
95
+ /**
96
+ * App-default plugin packages (by npm name OR absolute filesystem path).
97
+ * Each entry is resolved at boot, registered as a Pi package (so Pi sees
98
+ * its skills/extensions/prompts), and discovered by the
99
+ * `BoringPluginAssetManager` (so the workspace sees its
100
+ * package.json#boring contributions). One declaration, both sides.
101
+ *
102
+ * Equivalent to the user manually placing each package under
103
+ * `.pi/extensions/<name>/` and `pi install`-ing it — done programmatically
104
+ * at app boot. Combined with `.pi/extensions/<name>/` (user-added) and
105
+ * any `pi install npm:<pkg>` packages, all three flow through the same
106
+ * load process.
107
+ */
108
+ defaultPluginPackages?: string[];
109
+ /**
110
+ * Absolute path to the app's `package.json`. When passed, the workspace
111
+ * reads `package.json#boring.defaultPluginPackages: string[]` from it
112
+ * and merges those entries with anything passed in
113
+ * `defaultPluginPackages`. Relative entries in package.json resolve
114
+ * against the package.json's own directory.
115
+ *
116
+ * Example app `package.json`:
117
+ *
118
+ * {
119
+ * "name": "my-app",
120
+ * "boring": {
121
+ * "defaultPluginPackages": [
122
+ * "@hachej/boring-ask-user",
123
+ * "./src/plugins/playgroundDataCatalog"
124
+ * ]
125
+ * }
126
+ * }
127
+ *
128
+ * Lets apps declare their plugin set in the canonical app manifest
129
+ * instead of inside the server boot path.
130
+ */
131
+ appPackageJsonPath?: string;
36
132
  }
37
-
38
133
  interface WorkspaceAgentServerPluginCollection {
39
134
  provisioningContributions: WorkspaceProvisioningContribution[];
40
135
  routeContributions: WorkspaceRouteContribution[];
41
136
  preservedUiStateKeys: string[];
42
- agentOptions: Pick<WorkspaceAgentCreateOptions, "extraTools" | "systemPromptAppend" | "resourceLoaderOptions">;
137
+ agentOptions: Pick<WorkspaceAgentCreateOptions, "extraTools" | "systemPromptAppend" | "pi">;
43
138
  }
44
139
  interface CollectWorkspaceAgentServerPluginsOptions extends Pick<ServerBootstrapOptions, "plugins" | "defaults" | "excludeDefaults"> {
45
140
  workspaceRoot?: string;
46
141
  systemPromptAppend?: string;
47
- resourceLoaderOptions?: WorkspaceAgentResourceLoaderOptions;
142
+ pi?: WorkspaceAgentPiOptions;
48
143
  }
49
144
  declare function buildWorkspaceContextPrompt(): string;
50
145
  declare function collectWorkspaceAgentServerPlugins(opts?: CollectWorkspaceAgentServerPluginsOptions): WorkspaceAgentServerPluginCollection;
@@ -53,6 +148,26 @@ declare function provisionWorkspaceAgentServer(opts: {
53
148
  provisioningContributions?: WorkspaceProvisioningContribution[];
54
149
  force?: boolean;
55
150
  }): Promise<void>;
151
+ interface WorkspacePluginPackagePiSnapshot {
152
+ additionalSkillPaths: string[];
153
+ packages: PiPackageSource[];
154
+ extensionPaths: string[];
155
+ systemPromptAppend?: string;
156
+ }
157
+ declare function readWorkspacePluginPackagePiSnapshot(pluginDirs: string[]): WorkspacePluginPackagePiSnapshot;
56
158
  declare function createWorkspaceAgentServer(opts?: CreateWorkspaceAgentServerOptions): Promise<FastifyInstance>;
57
159
 
58
- export { type CollectWorkspaceAgentServerPluginsOptions, type CreateWorkspaceAgentServerOptions, type WorkspaceAgentResourceLoaderOptions, type WorkspaceAgentServerPluginCollection, type WorkspaceAgentServerPluginContext, type WorkspaceAgentServerPluginFactory, WorkspaceProvisioningContribution, WorkspaceRouteContribution, WorkspaceServerPlugin, buildWorkspaceContextPrompt, collectWorkspaceAgentServerPlugins, createWorkspaceAgentServer, provisionWorkspaceAgentServer };
160
+ interface ResolveDefaultWorkspacePluginPackagePathsOptions {
161
+ workspaceRoot?: string;
162
+ defaultPluginPackages?: string[];
163
+ appPackageJsonPath?: string;
164
+ }
165
+ /**
166
+ * Resolve app-default plugin package declarations exactly once for app hosts.
167
+ * This is shared by standalone workspace-agent and core composition so both
168
+ * read `package.json#boring.defaultPluginPackages` with the same relative-path
169
+ * and package-name semantics.
170
+ */
171
+ declare function resolveDefaultWorkspacePluginPackagePaths({ workspaceRoot, defaultPluginPackages, appPackageJsonPath, }?: ResolveDefaultWorkspacePluginPackagePathsOptions): string[];
172
+
173
+ export { type CollectWorkspaceAgentServerPluginsOptions, type CreateWorkspaceAgentServerOptions, type DirPluginEntry, type PluginResolveContext, type ResolveDefaultWorkspacePluginPackagePathsOptions, type WorkspaceAgentPiOptions, type WorkspaceAgentServerPluginCollection, type WorkspaceAgentServerPluginContext, type WorkspacePluginEntry, type WorkspacePluginPackagePiSnapshot, WorkspaceProvisioningContribution, WorkspaceRouteContribution, buildWorkspaceContextPrompt, collectWorkspaceAgentServerPlugins, createWorkspaceAgentServer, hasDirServerPlugin, provisionWorkspaceAgentServer, readWorkspacePluginPackagePiSnapshot, resolveDefaultWorkspacePluginPackagePaths, resolveOnePluginEntry };