@hachej/boring-workspace 0.1.33 → 0.1.35
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/dist/{FileTree-SmsE0Raq.js → FileTree-CkCxHBDu.js} +1 -1
- package/dist/MarkdownEditor-CtPphEVP.js +549 -0
- package/dist/{WorkspaceLoadingState-BlvZXmFg.js → WorkspaceLoadingState-Bl-92Dly.js} +287 -252
- package/dist/WorkspaceProvider-BhRPFy5R.js +7508 -0
- package/dist/app-front.d.ts +50 -3
- package/dist/app-front.js +893 -756
- package/dist/app-server.d.ts +11 -8
- package/dist/app-server.js +609 -79
- package/dist/boring-workspace.css +1 -1
- package/dist/{createInMemoryBridge-HJopAIbo.d.ts → createInMemoryBridge-zb8MpO60.d.ts} +11 -1
- package/dist/plugin.d.ts +8 -0
- package/dist/plugin.js +8 -1
- package/dist/runtime-server.d.ts +47 -0
- package/dist/runtime-server.js +32 -0
- package/dist/server.d.ts +63 -25
- package/dist/server.js +555 -46
- package/dist/testing.js +1 -1
- package/dist/workspace.css +328 -30
- package/dist/workspace.d.ts +68 -2
- package/dist/workspace.js +31 -30
- package/docs/PLUGIN_SYSTEM.md +5 -6
- package/package.json +10 -4
- package/dist/MarkdownEditor-zbp8ezds.js +0 -540
- package/dist/WorkspaceProvider-CuIZx1ua.js +0 -6553
|
@@ -1 +1 @@
|
|
|
1
|
-
.dv-shell{--dv-background-color: var(--background);--dv-paneview-header-border-color: var(--border);--dv-tabs-and-actions-container-font-size: .8125rem;--dv-tabs-and-actions-container-height: 52px;--dv-tab-close-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E");--dv-group-view-background-color: var(--background);--dv-tabs-and-actions-container-background-color: var(--background);--dv-activegroup-visiblepanel-tab-background-color: var(--background);--dv-activegroup-hiddenpanel-tab-background-color: var(--muted);--dv-inactivegroup-visiblepanel-tab-background-color: var(--background);--dv-inactivegroup-hiddenpanel-tab-background-color: var(--muted);--dv-activegroup-visiblepanel-tab-color: var(--foreground);--dv-activegroup-hiddenpanel-tab-color: var(--muted-foreground);--dv-inactivegroup-visiblepanel-tab-color: var(--foreground);--dv-inactivegroup-hiddenpanel-tab-color: var(--muted-foreground);--dv-tab-divider-color: transparent;--dv-drag-over-background-color: oklch(from var(--accent) l c h / .3);--dv-drag-over-border-color: var(--accent);--dv-separator-border: var(--border);color:var(--foreground);background-color:var(--background)}.dv-shell .dv-tabs-and-actions-container,.dv-shell .tabs-and-actions-container{background-color:var(--background)!important;border-bottom:1px solid oklch(from var(--border) l c h / .4);padding:6px 8px 0;gap:4px;align-items:flex-end}.dv-shell .dv-tabs-container,.dv-shell .tab-container{background-color:transparent!important;gap:4px;align-self:stretch;display:flex;align-items:flex-end}.workbench-dockview .dv-shell .dv-tabs-and-actions-container,.workbench-dockview .dv-shell .tabs-and-actions-container,.workbench-dockview .dv-tabs-and-actions-container,.workbench-dockview .tabs-and-actions-container{height:44px!important}.workbench-dockview[data-collapsed-sources=true] .dv-tabs-and-actions-container,.workbench-dockview[data-collapsed-sources=true] .tabs-and-actions-container{padding-left:44px!important}.workbench-dockview .dv-tabs-and-actions-container,.workbench-dockview .tabs-and-actions-container{padding-right:44px!important}.dv-shell .dv-tab,.dv-shell .tab{color:var(--muted-foreground)!important;background-color:transparent!important;border:1px solid transparent;border-top-left-radius:8px;border-top-right-radius:8px;transition:color .18s cubic-bezier(.22,1,.36,1),background-color .18s cubic-bezier(.22,1,.36,1),border-color .18s cubic-bezier(.22,1,.36,1);min-width:120px;max-width:220px;padding:0;height:34px;align-self:end;font-size:12.5px;letter-spacing:-.01em}.dv-shell .dv-tab:hover,.dv-shell .tab:hover{color:var(--foreground)!important;background-color:oklch(from var(--foreground) l c h / .04)!important}.dv-shell .dv-tab>*,.dv-shell .tab>*{width:100%;height:100%}.dv-shell .dv-tab.dv-active-tab,.dv-shell .tab.active-tab{color:var(--foreground)!important;background-color:var(--background)!important;border-color:oklch(from var(--border) l c h / .5);border-bottom-color:var(--background);margin-bottom:-1px;position:relative;z-index:1;font-weight:500}.dv-shell .dv-tab.dv-active-tab:before,.dv-shell .tab.active-tab:before{content:"";position:absolute;left:10px;right:10px;top:-1px;height:2px;background:var(--accent);border-radius:0 0 2px 2px;opacity:0;transition:opacity .2s cubic-bezier(.22,1,.36,1)}.dv-shell .dv-tab.dv-active-tab:hover:before,.dv-shell .tab.active-tab:hover:before{opacity:.7}.dv-shell .sash-container .sash,.dv-shell .dv-sash-container .dv-sash{transition:background-color .2s}.dv-shell .sash-container .sash:hover,.dv-shell .sash-container .sash.active,.dv-shell .dv-sash-container .dv-sash:hover,.dv-shell .dv-sash-container .dv-sash.dv-active{background-color:var(--primary);transition-delay:.15s}.dv-shell .drop-target-dropzone>.drop-target-selection,.dv-shell .dv-drop-target-dropzone>.dv-drop-target-selection{background-color:oklch(from var(--primary) l c h / .15);border:2px dashed var(--primary);border-radius:calc(var(--radius) - 2px)}.dv-shell .watermark,.dv-shell .dv-watermark{color:var(--muted-foreground)}.dv-shell,.dv-shell .dv-dockview,.dv-shell .dv-groupview,.dv-shell .groupview,.dv-shell .groupview>.content-container,.dv-shell .dv-view-container,.dv-shell .view-container{background-color:var(--background)}.dv-shell .dv-groupview,.dv-shell .groupview{color:var(--foreground)}.dv-shell .right-actions-container,.dv-shell .left-actions-container,.dv-shell .dv-right-actions-container,.dv-shell .dv-left-actions-container{color:var(--muted-foreground);display:flex;align-items:center;align-self:stretch}.dv-shell .right-actions-container:hover,.dv-shell .left-actions-container:hover,.dv-shell .dv-right-actions-container:hover,.dv-shell .dv-left-actions-container:hover{color:var(--foreground)}.dv-shell .dv-drag-image{opacity:.85;border:1px solid var(--border);border-radius:calc(var(--radius) - 2px);box-shadow:0 4px 12px #00000026}
|
|
1
|
+
.dv-shell{--dv-background-color: var(--background);--dv-paneview-header-border-color: var(--border);--dv-tabs-and-actions-container-font-size: .8125rem;--dv-tabs-and-actions-container-height: 52px;--dv-tab-close-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E");--dv-group-view-background-color: var(--background);--dv-tabs-and-actions-container-background-color: var(--background);--dv-activegroup-visiblepanel-tab-background-color: var(--background);--dv-activegroup-hiddenpanel-tab-background-color: var(--muted);--dv-inactivegroup-visiblepanel-tab-background-color: var(--background);--dv-inactivegroup-hiddenpanel-tab-background-color: var(--muted);--dv-activegroup-visiblepanel-tab-color: var(--foreground);--dv-activegroup-hiddenpanel-tab-color: var(--muted-foreground);--dv-inactivegroup-visiblepanel-tab-color: var(--foreground);--dv-inactivegroup-hiddenpanel-tab-color: var(--muted-foreground);--dv-tab-divider-color: transparent;--dv-drag-over-background-color: oklch(from var(--accent) l c h / .3);--dv-drag-over-border-color: var(--accent);--dv-separator-border: var(--border);color:var(--foreground);background-color:var(--background)}.dv-shell .dv-tabs-and-actions-container,.dv-shell .tabs-and-actions-container{background-color:var(--background)!important;border-bottom:1px solid oklch(from var(--border) l c h / .4);padding:6px 8px 0;gap:4px;align-items:flex-end}.dv-shell .dv-tabs-container,.dv-shell .tab-container{background-color:transparent!important;gap:4px;align-self:stretch;display:flex;align-items:flex-end}.workbench-dockview .dv-shell .dv-tabs-and-actions-container,.workbench-dockview .dv-shell .tabs-and-actions-container,.workbench-dockview .dv-tabs-and-actions-container,.workbench-dockview .tabs-and-actions-container{height:44px!important}.workbench-dockview[data-collapsed-sources=true] .dv-tabs-and-actions-container,.workbench-dockview[data-collapsed-sources=true] .tabs-and-actions-container{padding-left:44px!important}.workbench-dockview .dv-tabs-and-actions-container,.workbench-dockview .tabs-and-actions-container{padding-right:44px!important}.dv-shell .dv-tab,.dv-shell .tab{color:var(--muted-foreground)!important;background-color:transparent!important;border:1px solid transparent;border-top-left-radius:8px;border-top-right-radius:8px;transition:color .18s cubic-bezier(.22,1,.36,1),background-color .18s cubic-bezier(.22,1,.36,1),border-color .18s cubic-bezier(.22,1,.36,1);min-width:120px;max-width:220px;padding:0;height:34px;align-self:end;font-size:12.5px;letter-spacing:-.01em}.dv-shell .dv-tab:hover,.dv-shell .tab:hover{color:var(--foreground)!important;background-color:oklch(from var(--foreground) l c h / .04)!important}.dv-shell .dv-tab>*,.dv-shell .tab>*{width:100%;height:100%}.dv-shell .dv-tab.dv-active-tab,.dv-shell .tab.active-tab{color:var(--foreground)!important;background-color:var(--background)!important;border-color:oklch(from var(--border) l c h / .5);border-bottom-color:var(--background);margin-bottom:-1px;position:relative;z-index:1;font-weight:500}.dv-shell .dv-tab.dv-active-tab:before,.dv-shell .tab.active-tab:before{content:"";position:absolute;left:10px;right:10px;top:-1px;height:2px;background:var(--accent);border-radius:0 0 2px 2px;opacity:0;transition:opacity .2s cubic-bezier(.22,1,.36,1)}.dv-shell .dv-tab.dv-active-tab:hover:before,.dv-shell .tab.active-tab:hover:before{opacity:.7}.dv-shell .sash-container .sash,.dv-shell .dv-sash-container .dv-sash{transition:background-color .2s}.dv-shell .sash-container .sash:hover,.dv-shell .sash-container .sash.active,.dv-shell .dv-sash-container .dv-sash:hover,.dv-shell .dv-sash-container .dv-sash.dv-active{background-color:var(--primary);transition-delay:.15s}.dv-shell .drop-target-dropzone>.drop-target-selection,.dv-shell .dv-drop-target-dropzone>.dv-drop-target-selection{background-color:oklch(from var(--primary) l c h / .15);border:2px dashed var(--primary);border-radius:calc(var(--radius) - 2px)}.dv-shell .watermark,.dv-shell .dv-watermark{color:var(--muted-foreground)}.dv-shell,.dv-shell .dv-dockview,.dv-shell .dv-groupview,.dv-shell .groupview,.dv-shell .groupview>.content-container,.dv-shell .dv-view-container,.dv-shell .view-container{background-color:var(--background)}.dv-shell .dv-groupview,.dv-shell .groupview{color:var(--foreground)}.dv-shell .right-actions-container,.dv-shell .left-actions-container,.dv-shell .dv-right-actions-container,.dv-shell .dv-left-actions-container{color:var(--muted-foreground);display:flex;align-items:center;align-self:stretch}.dv-shell .right-actions-container:hover,.dv-shell .left-actions-container:hover,.dv-shell .dv-right-actions-container:hover,.dv-shell .dv-left-actions-container:hover{color:var(--foreground)}.dv-shell .dv-drag-image{opacity:.85;border:1px solid var(--border);border-radius:calc(var(--radius) - 2px);box-shadow:0 4px 12px #00000026}.dv-chat-stage{--dv-tabs-and-actions-container-height: 32px;--dv-tabs-and-actions-container-font-size: .75rem;--dv-activegroup-visiblepanel-tab-background-color: transparent;--dv-activegroup-hiddenpanel-tab-background-color: transparent;--dv-inactivegroup-visiblepanel-tab-background-color: transparent;--dv-inactivegroup-hiddenpanel-tab-background-color: transparent}.dv-shell.dv-chat-stage .dv-tabs-and-actions-container{border-bottom:none;padding:0;gap:0;align-items:stretch}.dv-shell.dv-chat-stage .dv-tabs-and-actions-container.dv-single-tab .dv-tabs-container{width:100%}.dv-shell.dv-chat-stage .dv-tab,.dv-shell.dv-chat-stage .dv-tab.dv-active-tab{width:100%;height:100%;min-width:0;max-width:none;flex:1 1 auto;align-self:stretch;margin-bottom:0;padding:0;border:none;border-radius:0;background-color:transparent!important}.dv-shell.dv-chat-stage .dv-tab.dv-active-tab:before{content:none}.dv-chat-stage .dv-default-tab-action{display:none}.dv-chat-stage .dv-groupview{position:relative}.dv-chat-stage .dv-groupview:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:40;pointer-events:none;background:transparent;transition:background-color .22s cubic-bezier(.22,1,.36,1),box-shadow .22s cubic-bezier(.22,1,.36,1)}[data-boring-workspace-part=chat-pane-stage][data-multi-pane=true] .dv-groupview:not(.dv-active-group):after{background:oklch(from var(--foreground) l c h / .035)}
|
|
@@ -46,11 +46,20 @@ interface BoringPluginListEntry$1 {
|
|
|
46
46
|
frontTarget?: BoringPluginFrontTarget$1;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
type BoringPluginSourceKind = "internal" | "external";
|
|
50
|
+
interface BoringPluginSource {
|
|
51
|
+
rootDir: string;
|
|
52
|
+
kind: BoringPluginSourceKind;
|
|
53
|
+
workspaceId?: string;
|
|
54
|
+
}
|
|
55
|
+
type BoringPluginSourceInput = string | BoringPluginSource;
|
|
49
56
|
interface BoringServerPluginManifest {
|
|
50
57
|
id: string;
|
|
51
58
|
rootDir: string;
|
|
52
59
|
version: string;
|
|
53
60
|
boring: BoringPackageBoringField;
|
|
61
|
+
/** True when package.json explicitly declares a boring manifest. Pi-only packages remain valid Pi resources but are not listed as Boring plugins. */
|
|
62
|
+
hasBoring: boolean;
|
|
54
63
|
pi?: BoringPackagePiField;
|
|
55
64
|
frontPath?: string;
|
|
56
65
|
/** Legacy Vite-dev browser import fallback (`/@fs/...`). */
|
|
@@ -58,6 +67,7 @@ interface BoringServerPluginManifest {
|
|
|
58
67
|
serverPath?: string;
|
|
59
68
|
extensionPaths?: string[];
|
|
60
69
|
skillPaths?: string[];
|
|
70
|
+
source: BoringPluginSource;
|
|
61
71
|
}
|
|
62
72
|
type BoringPluginNativeFrontTargetTrust = BoringPluginNativeFrontTargetTrust$1;
|
|
63
73
|
type BoringPluginNativeFrontTarget = BoringPluginNativeFrontTarget$1;
|
|
@@ -168,4 +178,4 @@ declare function bootstrapServer(options: ServerBootstrapOptions): ServerBootstr
|
|
|
168
178
|
|
|
169
179
|
declare function createInMemoryBridge(): UiBridge;
|
|
170
180
|
|
|
171
|
-
export { type
|
|
181
|
+
export { type BoringPluginSourceInput as B, type PluginRestartSurface as P, type ServerBootstrapOptions as S, type WorkspaceServerPlugin as W, type BoringPluginFrontTargetResolver as a, type WorkspaceProvisioningContribution as b, type WorkspaceRouteContribution as c, createInMemoryBridge as d, type WorkspaceRuntimeProvisioningInput as e, type WorkspaceServerPluginAsset as f, type BoringServerPluginManifest as g, type BoringPluginListEntry as h, type BoringPluginFrontTarget as i, type BoringPluginSource as j, type BoringPluginEvent as k, type BoringPluginFrontTargetResolverContext as l, type BoringPluginNativeFrontTarget as m, type BoringPluginNativeFrontTargetTrust as n, type BoringPluginSourceKind as o, type ServerBootstrapResult as p, bootstrapServer as q, defineServerPlugin as r, validateServerPlugin as v };
|
package/dist/plugin.d.ts
CHANGED
|
@@ -128,6 +128,11 @@ interface BoringFrontSurfaceResolverRegistration {
|
|
|
128
128
|
source?: string;
|
|
129
129
|
resolve: (request: SurfaceOpenRequest) => SurfacePanelResolution | null | undefined;
|
|
130
130
|
}
|
|
131
|
+
type BoringFrontToolRenderer = (part: unknown) => ReactNode;
|
|
132
|
+
interface BoringFrontToolRendererRegistration {
|
|
133
|
+
id: string;
|
|
134
|
+
render: BoringFrontToolRenderer;
|
|
135
|
+
}
|
|
131
136
|
interface BoringFrontAPI {
|
|
132
137
|
registerProvider(registration: BoringFrontProviderRegistration): void;
|
|
133
138
|
registerBinding(registration: BoringFrontBindingRegistration): void;
|
|
@@ -136,6 +141,7 @@ interface BoringFrontAPI {
|
|
|
136
141
|
registerPanelCommand(registration: BoringFrontPanelCommandRegistration): void;
|
|
137
142
|
registerLeftTab<T = LeftTabParams>(registration: BoringFrontLeftTabRegistration<T>): void;
|
|
138
143
|
registerSurfaceResolver(registration: BoringFrontSurfaceResolverRegistration): void;
|
|
144
|
+
registerToolRenderer(registration: BoringFrontToolRendererRegistration): void;
|
|
139
145
|
}
|
|
140
146
|
type BoringFrontFactory = (api: BoringFrontAPI) => void | Promise<void>;
|
|
141
147
|
type BoringFrontSetup = (api: BoringFrontAPI) => void;
|
|
@@ -164,6 +170,7 @@ interface DefinePluginConfig {
|
|
|
164
170
|
providers?: ReadonlyArray<BoringFrontProviderRegistration>;
|
|
165
171
|
bindings?: ReadonlyArray<BoringFrontBindingRegistration>;
|
|
166
172
|
catalogs?: ReadonlyArray<CatalogConfig>;
|
|
173
|
+
toolRenderers?: ReadonlyArray<BoringFrontToolRendererRegistration>;
|
|
167
174
|
/**
|
|
168
175
|
* Escape hatch for registrations that can't be expressed declaratively.
|
|
169
176
|
* Called LAST, after every declarative field has been registered.
|
|
@@ -187,6 +194,7 @@ interface CapturedBoringFrontRegistrations {
|
|
|
187
194
|
panelCommands: BoringFrontPanelCommandRegistration[];
|
|
188
195
|
leftTabs: BoringFrontLeftTabRegistration<any>[];
|
|
189
196
|
surfaceResolvers: BoringFrontSurfaceResolverRegistration[];
|
|
197
|
+
toolRenderers: BoringFrontToolRendererRegistration[];
|
|
190
198
|
}
|
|
191
199
|
interface CapturedFrontPlugin {
|
|
192
200
|
id: string;
|
package/dist/plugin.js
CHANGED
|
@@ -29,6 +29,7 @@ function definePlugin(config) {
|
|
|
29
29
|
for (const provider of config.providers ?? []) api.registerProvider(provider);
|
|
30
30
|
for (const binding of config.bindings ?? []) api.registerBinding(binding);
|
|
31
31
|
for (const catalog of config.catalogs ?? []) api.registerCatalog(catalog);
|
|
32
|
+
for (const renderer of config.toolRenderers ?? []) api.registerToolRenderer(renderer);
|
|
32
33
|
if (config.setup) config.setup(api);
|
|
33
34
|
return void 0;
|
|
34
35
|
};
|
|
@@ -57,6 +58,7 @@ function createCapturingBoringFrontAPI(options = {}) {
|
|
|
57
58
|
const panelCommands = [];
|
|
58
59
|
const leftTabs = [];
|
|
59
60
|
const surfaceResolvers = [];
|
|
61
|
+
const toolRenderers = [];
|
|
60
62
|
const seen = /* @__PURE__ */ new Map();
|
|
61
63
|
const claim = (kind, id) => {
|
|
62
64
|
const key = `${kind}:${id}`;
|
|
@@ -104,6 +106,10 @@ function createCapturingBoringFrontAPI(options = {}) {
|
|
|
104
106
|
}
|
|
105
107
|
surfaceResolvers.push(registration);
|
|
106
108
|
},
|
|
109
|
+
registerToolRenderer(registration) {
|
|
110
|
+
claim("tool-renderer", registration.id);
|
|
111
|
+
toolRenderers.push(registration);
|
|
112
|
+
},
|
|
107
113
|
flush() {
|
|
108
114
|
return {
|
|
109
115
|
providers: clone(providers),
|
|
@@ -112,7 +118,8 @@ function createCapturingBoringFrontAPI(options = {}) {
|
|
|
112
118
|
panels: clone(panels),
|
|
113
119
|
panelCommands: clone(panelCommands),
|
|
114
120
|
leftTabs: clone(leftTabs),
|
|
115
|
-
surfaceResolvers: clone(surfaceResolvers)
|
|
121
|
+
surfaceResolvers: clone(surfaceResolvers),
|
|
122
|
+
toolRenderers: clone(toolRenderers)
|
|
116
123
|
};
|
|
117
124
|
}
|
|
118
125
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
interface PluginLogger {
|
|
2
|
+
debug(fields: Record<string, unknown>, message?: string): void;
|
|
3
|
+
debug(message: string): void;
|
|
4
|
+
info(fields: Record<string, unknown>, message?: string): void;
|
|
5
|
+
info(message: string): void;
|
|
6
|
+
warn(fields: Record<string, unknown>, message?: string): void;
|
|
7
|
+
warn(message: string): void;
|
|
8
|
+
error(fields: Record<string, unknown>, message?: string): void;
|
|
9
|
+
error(message: string): void;
|
|
10
|
+
}
|
|
11
|
+
type ReadonlyHeaders = Pick<Headers, "entries" | "forEach" | "get" | "has" | typeof Symbol.iterator>;
|
|
12
|
+
interface RuntimePluginContext {
|
|
13
|
+
pluginId: string;
|
|
14
|
+
method: string;
|
|
15
|
+
path: string;
|
|
16
|
+
query: URLSearchParams;
|
|
17
|
+
headers: ReadonlyHeaders;
|
|
18
|
+
signal: AbortSignal;
|
|
19
|
+
body: unknown;
|
|
20
|
+
logger: PluginLogger;
|
|
21
|
+
}
|
|
22
|
+
type RuntimePluginHandler = (ctx: RuntimePluginContext) => unknown | Promise<unknown>;
|
|
23
|
+
interface RuntimePluginRouter {
|
|
24
|
+
get(path: string, handler: RuntimePluginHandler): void;
|
|
25
|
+
post(path: string, handler: RuntimePluginHandler): void;
|
|
26
|
+
put(path: string, handler: RuntimePluginHandler): void;
|
|
27
|
+
patch(path: string, handler: RuntimePluginHandler): void;
|
|
28
|
+
delete(path: string, handler: RuntimePluginHandler): void;
|
|
29
|
+
head(path: string, handler: RuntimePluginHandler): void;
|
|
30
|
+
options(path: string, handler: RuntimePluginHandler): void;
|
|
31
|
+
all(path: string, handler: RuntimePluginHandler): void;
|
|
32
|
+
}
|
|
33
|
+
interface RuntimePluginResponse {
|
|
34
|
+
kind: "response";
|
|
35
|
+
status?: number;
|
|
36
|
+
headers?: Record<string, string>;
|
|
37
|
+
body?: unknown;
|
|
38
|
+
}
|
|
39
|
+
interface RuntimeServerPlugin {
|
|
40
|
+
routes(router: RuntimePluginRouter): void | Promise<void>;
|
|
41
|
+
dispose?(): void | Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
declare function defineRuntimeServerPlugin(plugin: RuntimeServerPlugin): RuntimeServerPlugin;
|
|
44
|
+
declare function validateRuntimeServerPlugin(value: unknown): RuntimeServerPlugin;
|
|
45
|
+
declare function isRuntimePluginResponse(value: unknown): value is RuntimePluginResponse;
|
|
46
|
+
|
|
47
|
+
export { type PluginLogger, type ReadonlyHeaders, type RuntimePluginContext, type RuntimePluginHandler, type RuntimePluginResponse, type RuntimePluginRouter, type RuntimeServerPlugin, defineRuntimeServerPlugin, isRuntimePluginResponse, validateRuntimeServerPlugin };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/server/runtimeBackend/defineRuntimeServerPlugin.ts
|
|
2
|
+
function defineRuntimeServerPlugin(plugin) {
|
|
3
|
+
return plugin;
|
|
4
|
+
}
|
|
5
|
+
function isPlainObject(value) {
|
|
6
|
+
if (typeof value !== "object" || value === null) return false;
|
|
7
|
+
const proto = Object.getPrototypeOf(value);
|
|
8
|
+
return proto === Object.prototype || proto === null;
|
|
9
|
+
}
|
|
10
|
+
function validateRuntimeServerPlugin(value) {
|
|
11
|
+
if (!isPlainObject(value)) {
|
|
12
|
+
throw new Error("runtime server plugin default export must be a plain object");
|
|
13
|
+
}
|
|
14
|
+
if ("id" in value) {
|
|
15
|
+
throw new Error("runtime server plugin must not declare id; the host supplies plugin id from package metadata");
|
|
16
|
+
}
|
|
17
|
+
if (typeof value.routes !== "function") {
|
|
18
|
+
throw new Error("runtime server plugin default export must define routes(router)");
|
|
19
|
+
}
|
|
20
|
+
if (value.dispose !== void 0 && typeof value.dispose !== "function") {
|
|
21
|
+
throw new Error("runtime server plugin dispose must be a function when provided");
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
function isRuntimePluginResponse(value) {
|
|
26
|
+
return isPlainObject(value) && value.kind === "response";
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
defineRuntimeServerPlugin,
|
|
30
|
+
isRuntimePluginResponse,
|
|
31
|
+
validateRuntimeServerPlugin
|
|
32
|
+
};
|
package/dist/server.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { f as WorkspaceServerPluginAsset, g as BoringServerPluginManifest, B as BoringPluginSourceInput, a as BoringPluginFrontTargetResolver, h as BoringPluginListEntry, i as BoringPluginFrontTarget, j as BoringPluginSource, k as BoringPluginEvent, P as PluginRestartSurface } from './createInMemoryBridge-zb8MpO60.js';
|
|
2
|
+
export { l as BoringPluginFrontTargetResolverContext, m as BoringPluginNativeFrontTarget, n as BoringPluginNativeFrontTargetTrust, o as BoringPluginSourceKind, S as ServerBootstrapOptions, p as ServerBootstrapResult, b as WorkspaceProvisioningContribution, c as WorkspaceRouteContribution, W as WorkspaceServerPlugin, q as bootstrapServer, d as createInMemoryBridge, r as defineServerPlugin, v as validateServerPlugin } from './createInMemoryBridge-zb8MpO60.js';
|
|
3
3
|
import { FastifyRequest, FastifyInstance } from 'fastify';
|
|
4
4
|
import { U as UiBridge, A as AgentTool } from './ui-bridge-DFNem0df.js';
|
|
5
5
|
export { C as CommandResult, a as UiCommand, b as UiState } from './ui-bridge-DFNem0df.js';
|
|
6
6
|
import { PiPackageSource } from '@hachej/boring-agent/server';
|
|
7
7
|
export { PiPackageSource as WorkspacePiPackageSource } from '@hachej/boring-agent/server';
|
|
8
|
+
import { PluginLogger } from './runtime-server.js';
|
|
9
|
+
export { RuntimePluginContext, RuntimePluginHandler, RuntimePluginResponse, RuntimePluginRouter, RuntimeServerPlugin, defineRuntimeServerPlugin, validateRuntimeServerPlugin } from './runtime-server.js';
|
|
10
|
+
import { ErrorCode } from '@hachej/boring-agent/shared';
|
|
8
11
|
import './manifest-C2vVgH_e.js';
|
|
9
12
|
|
|
10
13
|
declare function definePluginAsset(importMetaUrl: string, name: string, relativeSource: string, options?: {
|
|
@@ -171,12 +174,12 @@ interface BoringPluginScanResult {
|
|
|
171
174
|
preflight: BoringPluginPreflightResult;
|
|
172
175
|
plugins: BoringServerPluginManifest[];
|
|
173
176
|
}
|
|
174
|
-
declare function scanBoringPlugins(pluginDirs:
|
|
175
|
-
declare function preflightBoringPlugins(pluginDirs:
|
|
176
|
-
declare function readBoringPlugins(pluginDirs:
|
|
177
|
+
declare function scanBoringPlugins(pluginDirs: BoringPluginSourceInput[]): BoringPluginScanResult;
|
|
178
|
+
declare function preflightBoringPlugins(pluginDirs: BoringPluginSourceInput[]): BoringPluginPreflightResult;
|
|
179
|
+
declare function readBoringPlugins(pluginDirs: BoringPluginSourceInput[]): BoringServerPluginManifest[];
|
|
177
180
|
|
|
178
181
|
interface BoringPluginAssetManagerOptions {
|
|
179
|
-
pluginDirs:
|
|
182
|
+
pluginDirs: BoringPluginSourceInput[];
|
|
180
183
|
/**
|
|
181
184
|
* Root directory for per-plugin `.error` sidecar files written by the
|
|
182
185
|
* asset manager and read by verify-plugin. Defaults to `<cwd>/.pi/extensions`.
|
|
@@ -212,6 +215,8 @@ interface LoadedBoringPluginInspection {
|
|
|
212
215
|
rootDir: string;
|
|
213
216
|
frontPath?: string;
|
|
214
217
|
frontTarget?: BoringPluginFrontTarget;
|
|
218
|
+
serverPath?: string;
|
|
219
|
+
source: BoringPluginSource;
|
|
215
220
|
}
|
|
216
221
|
interface LoadedBoringPluginPiSnapshot {
|
|
217
222
|
additionalSkillPaths: string[];
|
|
@@ -253,14 +258,6 @@ declare class BoringPluginAssetManager {
|
|
|
253
258
|
private clearError;
|
|
254
259
|
}
|
|
255
260
|
|
|
256
|
-
interface PluginReloadRebuild {
|
|
257
|
-
ok: boolean;
|
|
258
|
-
diagnostics: {
|
|
259
|
-
source: string;
|
|
260
|
-
message: string;
|
|
261
|
-
pluginId?: string;
|
|
262
|
-
}[];
|
|
263
|
-
}
|
|
264
261
|
/**
|
|
265
262
|
* One per plugin whose load event carried a non-empty
|
|
266
263
|
* `requiresRestart` field. Surfaced alongside the /reload response so
|
|
@@ -281,16 +278,6 @@ interface PluginRestartWarning {
|
|
|
281
278
|
declare function collectRestartWarnings(events: BoringPluginEvent[]): PluginRestartWarning[];
|
|
282
279
|
interface BoringPluginRoutesOptions {
|
|
283
280
|
manager: BoringPluginAssetManager;
|
|
284
|
-
/**
|
|
285
|
-
* Server-side plugin rebuild closure (jiti re-import of dir-source
|
|
286
|
-
* entries). Called AFTER the asset manager scan. Per-plugin failures
|
|
287
|
-
* surface as diagnostics; combined with asset-manager errors into the
|
|
288
|
-
* 422 response body so the agent's /reload UI can show them. Optional —
|
|
289
|
-
* tests that exercise the route in isolation can omit it.
|
|
290
|
-
*/
|
|
291
|
-
rebuildPlugins?: () => Promise<PluginReloadRebuild>;
|
|
292
|
-
/** Register the developer reload endpoint. Static discovery/listing remains available when false. */
|
|
293
|
-
enableReloadRoute?: boolean;
|
|
294
281
|
}
|
|
295
282
|
declare function boringPluginRoutes(app: FastifyInstance, opts: BoringPluginRoutesOptions): Promise<void>;
|
|
296
283
|
|
|
@@ -327,4 +314,55 @@ declare function pluginFileSignature(path: string | undefined): string;
|
|
|
327
314
|
declare function writePluginSignatureCache(pluginRootDir: string, payload: Omit<PluginSignatureCachePayload, "version" | "loadedAt"> & Partial<Pick<PluginSignatureCachePayload, "loadedAt">>): void;
|
|
328
315
|
declare function readPluginSignatureCache(pluginRootDir: string): PluginSignatureCachePayload | null;
|
|
329
316
|
|
|
330
|
-
|
|
317
|
+
interface RuntimeBackendDiagnostic {
|
|
318
|
+
pluginId?: string;
|
|
319
|
+
source: string;
|
|
320
|
+
code: ErrorCode;
|
|
321
|
+
message: string;
|
|
322
|
+
}
|
|
323
|
+
interface RuntimeBackendReloadResult {
|
|
324
|
+
ok: boolean;
|
|
325
|
+
diagnostics: RuntimeBackendDiagnostic[];
|
|
326
|
+
}
|
|
327
|
+
interface RuntimeBackendDispatchRequest {
|
|
328
|
+
pluginId: string;
|
|
329
|
+
method: string;
|
|
330
|
+
path: string;
|
|
331
|
+
query: URLSearchParams;
|
|
332
|
+
headers: Headers;
|
|
333
|
+
signal: AbortSignal;
|
|
334
|
+
body: unknown;
|
|
335
|
+
logger: PluginLogger;
|
|
336
|
+
workspaceId?: string;
|
|
337
|
+
}
|
|
338
|
+
interface RuntimeBackendDispatchResponse {
|
|
339
|
+
status: number;
|
|
340
|
+
headers: Record<string, string>;
|
|
341
|
+
body?: unknown;
|
|
342
|
+
}
|
|
343
|
+
declare class RuntimeBackendError extends Error {
|
|
344
|
+
readonly code: ErrorCode;
|
|
345
|
+
readonly statusCode: number;
|
|
346
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
347
|
+
constructor(code: ErrorCode, statusCode: number, message: string, details?: Record<string, unknown> | undefined);
|
|
348
|
+
}
|
|
349
|
+
declare class RuntimeBackendRegistry {
|
|
350
|
+
private readonly snapshots;
|
|
351
|
+
private lastDiagnostics;
|
|
352
|
+
private reloadQueue;
|
|
353
|
+
getDiagnostics(): RuntimeBackendDiagnostic[];
|
|
354
|
+
listPluginIds(): string[];
|
|
355
|
+
reloadFromLoadedPlugins(plugins: LoadedBoringPluginInspection[]): Promise<RuntimeBackendReloadResult>;
|
|
356
|
+
close(): Promise<RuntimeBackendReloadResult>;
|
|
357
|
+
dispatch(request: RuntimeBackendDispatchRequest): Promise<RuntimeBackendDispatchResponse>;
|
|
358
|
+
private reloadOnce;
|
|
359
|
+
private closeOnce;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
interface RuntimeBackendGatewayOptions {
|
|
363
|
+
registry: RuntimeBackendRegistry;
|
|
364
|
+
defaultWorkspaceId?: string;
|
|
365
|
+
}
|
|
366
|
+
declare function runtimeBackendGateway(app: FastifyInstance, opts: RuntimeBackendGatewayOptions): Promise<void>;
|
|
367
|
+
|
|
368
|
+
export { BoringPluginAssetManager, BoringPluginEvent, BoringPluginFrontTarget, BoringPluginFrontTargetResolver, BoringPluginListEntry, type BoringPluginScanResult, BoringPluginSource, BoringPluginSourceInput, BoringServerPluginManifest, type PluginRestartWarning, type RuntimeBackendDiagnostic, type RuntimeBackendDispatchRequest, type RuntimeBackendDispatchResponse, RuntimeBackendError, type RuntimeBackendGatewayOptions, RuntimeBackendRegistry, type RuntimeBackendReloadResult, UiBridge, type UiRoutesOptions, WorkspaceServerPluginAsset, aggregatePluginPrompts, boringPluginRoutes, buildBoringSystemPrompt, collectRestartWarnings, createExecUiTool, createGetUiStateTool, createWorkspaceUiTools, definePluginAsset, pluginFileSignature, preflightBoringPlugins, readBoringPlugins, readPluginSignatureCache, resolvePluginAssetPath, runtimeBackendGateway, scanBoringPlugins, uiRoutes, writePluginSignatureCache };
|