@hachej/boring-workspace 0.1.12 → 0.1.14
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/README.md +270 -42
- package/dist/CommandPalette-NOEOVkN2.js +5714 -0
- package/dist/{FileTree-BVfqs3rR.js → FileTree-Dl-qUAB0.js} +9 -9
- package/dist/MarkdownEditor-yc6mFsnI.js +533 -0
- package/dist/{WorkspaceLoadingState-CPQBxYFG.js → WorkspaceLoadingState-CSZfENWe.js} +178 -157
- package/dist/agent-tool-DEtfQPVB.d.ts +100 -0
- package/dist/app-front.d.ts +79 -67
- package/dist/app-front.js +253 -241
- package/dist/app-server.d.ts +17 -12
- package/dist/app-server.js +105 -23
- package/dist/{bootstrapServer-BRUqUpVW.d.ts → bootstrapServer-BreQ9QBc.d.ts} +8 -2
- package/dist/server.d.ts +13 -35
- package/dist/server.js +39 -137
- package/dist/shared.d.ts +1 -2
- package/dist/testing.d.ts +0 -63
- package/dist/testing.js +2248 -2401
- package/dist/workspace.css +1616 -977
- package/dist/workspace.d.ts +111 -450
- package/dist/workspace.js +417 -1635
- package/docs/INTERFACES.md +2 -2
- package/docs/PLUGIN_STRUCTURE.md +1 -1
- package/docs/plans/ASK_USER_QUESTIONS_PLUGIN_SPEC.md +131 -263
- package/docs/plans/GENERIC_EXPLORER_PLUGIN_PLAN.md +29 -27
- package/docs/plans/MACRO_PLUGIN_GENERIC_HELPERS_AUDIT.md +12 -12
- package/docs/plans/PANE_TO_AGENT_CHAT_ACTIONS_SPEC.md +366 -0
- package/docs/plans/README.md +2 -0
- package/docs/plans/archive/PLUGIN_MODEL.md +14 -14
- package/docs/plans/archive/SRC_FOLDER_REORG_PLAN.md +2 -3
- package/docs/plans/archive/WORKSPACE_V2_PLAN.md +1 -1
- package/package.json +3 -6
- package/dist/CommandPalette-Dme9em28.js +0 -5506
- package/dist/MarkdownEditor-CcCDF65H.js +0 -502
- package/dist/agent-tool-NvxKfist.d.ts +0 -28
- package/dist/explorer-DtLUnuah.d.ts +0 -129
package/dist/app-server.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PiPackageSource, 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, W as
|
|
5
|
-
export { C as ComposeServerPluginsOptions,
|
|
6
|
-
import './agent-tool-
|
|
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';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Standalone workspace + agent Fastify composition.
|
|
@@ -21,27 +21,32 @@ interface WorkspaceAgentResourceLoaderOptions {
|
|
|
21
21
|
type WorkspaceAgentCreateOptions = Omit<CreateAgentAppOptions, "resourceLoaderOptions"> & {
|
|
22
22
|
resourceLoaderOptions?: WorkspaceAgentResourceLoaderOptions;
|
|
23
23
|
};
|
|
24
|
+
interface WorkspaceAgentServerPluginContext {
|
|
25
|
+
workspaceRoot: string;
|
|
26
|
+
bridge: ReturnType<typeof createInMemoryBridge>;
|
|
27
|
+
}
|
|
28
|
+
type WorkspaceAgentServerPluginFactory = (context: WorkspaceAgentServerPluginContext) => WorkspaceServerPlugin;
|
|
24
29
|
interface CreateWorkspaceAgentServerOptions extends WorkspaceAgentCreateOptions, Pick<ServerBootstrapOptions, "plugins" | "defaults" | "excludeDefaults"> {
|
|
30
|
+
pluginFactories?: WorkspaceAgentServerPluginFactory[];
|
|
25
31
|
provisionWorkspace?: boolean;
|
|
26
32
|
workspaceProvisioning?: {
|
|
27
33
|
force?: boolean;
|
|
28
34
|
};
|
|
29
|
-
/**
|
|
30
|
-
* Whether exec_ui should stat-check file paths against the workspaceRoot
|
|
31
|
-
* before queueing the command. Defaults to true in direct/local mode and
|
|
32
|
-
* false in vercel-sandbox (where workspace files live inside the microVM,
|
|
33
|
-
* not on the host server running this Fastify process).
|
|
34
|
-
*/
|
|
35
35
|
validateUiPaths?: boolean;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
interface WorkspaceAgentServerPluginCollection {
|
|
39
39
|
provisioningContributions: WorkspaceProvisioningContribution[];
|
|
40
40
|
routeContributions: WorkspaceRouteContribution[];
|
|
41
|
+
preservedUiStateKeys: string[];
|
|
41
42
|
agentOptions: Pick<WorkspaceAgentCreateOptions, "extraTools" | "systemPromptAppend" | "resourceLoaderOptions">;
|
|
42
43
|
}
|
|
43
|
-
interface CollectWorkspaceAgentServerPluginsOptions extends Pick<
|
|
44
|
+
interface CollectWorkspaceAgentServerPluginsOptions extends Pick<ServerBootstrapOptions, "plugins" | "defaults" | "excludeDefaults"> {
|
|
45
|
+
workspaceRoot?: string;
|
|
46
|
+
systemPromptAppend?: string;
|
|
47
|
+
resourceLoaderOptions?: WorkspaceAgentResourceLoaderOptions;
|
|
44
48
|
}
|
|
49
|
+
declare function buildWorkspaceContextPrompt(): string;
|
|
45
50
|
declare function collectWorkspaceAgentServerPlugins(opts?: CollectWorkspaceAgentServerPluginsOptions): WorkspaceAgentServerPluginCollection;
|
|
46
51
|
declare function provisionWorkspaceAgentServer(opts: {
|
|
47
52
|
workspaceRoot: string;
|
|
@@ -50,4 +55,4 @@ declare function provisionWorkspaceAgentServer(opts: {
|
|
|
50
55
|
}): Promise<void>;
|
|
51
56
|
declare function createWorkspaceAgentServer(opts?: CreateWorkspaceAgentServerOptions): Promise<FastifyInstance>;
|
|
52
57
|
|
|
53
|
-
export { type CollectWorkspaceAgentServerPluginsOptions, type CreateWorkspaceAgentServerOptions, type WorkspaceAgentResourceLoaderOptions, type WorkspaceAgentServerPluginCollection, WorkspaceProvisioningContribution, WorkspaceRouteContribution, collectWorkspaceAgentServerPlugins, createWorkspaceAgentServer, provisionWorkspaceAgentServer };
|
|
58
|
+
export { type CollectWorkspaceAgentServerPluginsOptions, type CreateWorkspaceAgentServerOptions, type WorkspaceAgentResourceLoaderOptions, type WorkspaceAgentServerPluginCollection, type WorkspaceAgentServerPluginContext, type WorkspaceAgentServerPluginFactory, WorkspaceProvisioningContribution, WorkspaceRouteContribution, WorkspaceServerPlugin, buildWorkspaceContextPrompt, collectWorkspaceAgentServerPlugins, createWorkspaceAgentServer, provisionWorkspaceAgentServer };
|
package/dist/app-server.js
CHANGED
|
@@ -1,9 +1,58 @@
|
|
|
1
1
|
// src/app/server/createWorkspaceAgentServer.ts
|
|
2
2
|
import {
|
|
3
|
+
autoDetectMode,
|
|
3
4
|
createAgentApp,
|
|
4
|
-
provisionRuntimeWorkspace
|
|
5
|
+
provisionRuntimeWorkspace,
|
|
6
|
+
resolveMode
|
|
5
7
|
} from "@hachej/boring-agent/server";
|
|
6
|
-
import { join } from "path";
|
|
8
|
+
import { join as join2 } from "path";
|
|
9
|
+
|
|
10
|
+
// src/server/boringSystemPrompt.ts
|
|
11
|
+
import { existsSync, readFileSync } from "fs";
|
|
12
|
+
import { dirname, join } from "path";
|
|
13
|
+
import { fileURLToPath } from "url";
|
|
14
|
+
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
function resolveDocsPath() {
|
|
16
|
+
const override = process.env.BORING_DOCS_PATH;
|
|
17
|
+
if (override) return override;
|
|
18
|
+
const candidates = [
|
|
19
|
+
join(__dirname, "../docs"),
|
|
20
|
+
// dist/server.js → packages/workspace/docs/
|
|
21
|
+
join(__dirname, "../../docs")
|
|
22
|
+
// src/server/*.ts → packages/workspace/docs/
|
|
23
|
+
];
|
|
24
|
+
return candidates.find(existsSync) ?? null;
|
|
25
|
+
}
|
|
26
|
+
function readDocOrFallback(docsPath, name) {
|
|
27
|
+
const file = join(docsPath, name);
|
|
28
|
+
try {
|
|
29
|
+
return existsSync(file) ? readFileSync(file, "utf-8").trim() : "";
|
|
30
|
+
} catch {
|
|
31
|
+
return "";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function buildBoringSystemPrompt() {
|
|
35
|
+
const docsPath = resolveDocsPath();
|
|
36
|
+
const intro = `You are an expert agent operating inside boring-ui, an open-source workspace for building agent-powered products. You help users by reading files, executing commands, editing code, and opening workspace panels.`;
|
|
37
|
+
if (!docsPath) {
|
|
38
|
+
return intro;
|
|
39
|
+
}
|
|
40
|
+
const plugins = readDocOrFallback(docsPath, "plugins.md");
|
|
41
|
+
const panels = readDocOrFallback(docsPath, "panels.md");
|
|
42
|
+
const bridge = readDocOrFallback(docsPath, "bridge.md");
|
|
43
|
+
const sections = [
|
|
44
|
+
plugins && `<boring-ui-docs topic="plugin-system">
|
|
45
|
+
${plugins}
|
|
46
|
+
</boring-ui-docs>`,
|
|
47
|
+
panels && `<boring-ui-docs topic="panel-components">
|
|
48
|
+
${panels}
|
|
49
|
+
</boring-ui-docs>`,
|
|
50
|
+
bridge && `<boring-ui-docs topic="ui-bridge">
|
|
51
|
+
${bridge}
|
|
52
|
+
</boring-ui-docs>`
|
|
53
|
+
].filter(Boolean);
|
|
54
|
+
return [intro, ...sections].join("\n\n");
|
|
55
|
+
}
|
|
7
56
|
|
|
8
57
|
// src/server/bridge/createInMemoryBridge.ts
|
|
9
58
|
var MAX_PENDING_COMMANDS = 1e3;
|
|
@@ -49,7 +98,7 @@ function createInMemoryBridge() {
|
|
|
49
98
|
|
|
50
99
|
// src/server/ui-control/tools/uiTools.ts
|
|
51
100
|
import { access } from "fs/promises";
|
|
52
|
-
import { resolve, isAbsolute, relative } from "path";
|
|
101
|
+
import { resolve, isAbsolute, relative, win32 } from "path";
|
|
53
102
|
function makeError(message) {
|
|
54
103
|
return {
|
|
55
104
|
content: [{ type: "text", text: message }],
|
|
@@ -61,9 +110,15 @@ function getPathParam(kind, params) {
|
|
|
61
110
|
const raw = kind === "navigateToLine" ? params.file : params.path;
|
|
62
111
|
return typeof raw === "string" && raw.length > 0 ? raw : void 0;
|
|
63
112
|
}
|
|
113
|
+
function isPathAbsolute(filePath) {
|
|
114
|
+
return isAbsolute(filePath) || win32.isAbsolute(filePath);
|
|
115
|
+
}
|
|
116
|
+
function isOutsideWorkspaceRel(rel) {
|
|
117
|
+
return rel === ".." || rel.startsWith("../") || rel.startsWith("..\\") || isPathAbsolute(rel);
|
|
118
|
+
}
|
|
64
119
|
function validatePathSyntax(relPath, workspaceRoot) {
|
|
65
120
|
const rootHint = workspaceRoot ? ` (${workspaceRoot})` : "";
|
|
66
|
-
if (
|
|
121
|
+
if (isPathAbsolute(relPath)) {
|
|
67
122
|
return {
|
|
68
123
|
ok: false,
|
|
69
124
|
reason: `path "${relPath}" is absolute \u2014 pass a path relative to the workspace root${rootHint}.`
|
|
@@ -85,7 +140,7 @@ async function validatePath(workspaceRoot, relPath) {
|
|
|
85
140
|
if (!syntax.ok) return syntax;
|
|
86
141
|
const resolved = resolve(workspaceRoot, relPath);
|
|
87
142
|
const rel = relative(workspaceRoot, resolved);
|
|
88
|
-
if (
|
|
143
|
+
if (isOutsideWorkspaceRel(rel)) {
|
|
89
144
|
return {
|
|
90
145
|
ok: false,
|
|
91
146
|
reason: `path "${relPath}" escapes the workspace root (${workspaceRoot}).`
|
|
@@ -188,13 +243,14 @@ function createExecUiTool(uiBridge, opts = {}) {
|
|
|
188
243
|
" auto-opens if collapsed. Path must be relative to the",
|
|
189
244
|
" workspace root (e.g. `src/foo.ts`, not `foo.ts` if it",
|
|
190
245
|
" lives under src/).",
|
|
191
|
-
" Recovery on file-not-found:
|
|
192
|
-
"
|
|
193
|
-
" exist. On that error,
|
|
194
|
-
" grep) to locate the file,
|
|
195
|
-
" openFile AGAIN using the EXACT path
|
|
196
|
-
" give up and don't switch to the read
|
|
197
|
-
" until openFile succeeds or no candidate
|
|
246
|
+
" Recovery on file-not-found: when the server has local",
|
|
247
|
+
" filesystem access, this tool stat-checks the path and",
|
|
248
|
+
" returns an error if it doesn't exist. On that error,",
|
|
249
|
+
" immediately call find (or grep) to locate the file,",
|
|
250
|
+
" then call exec_ui openFile AGAIN using the EXACT path",
|
|
251
|
+
" returned \u2014 don't give up and don't switch to the read",
|
|
252
|
+
" tool. Repeat until openFile succeeds or no candidate",
|
|
253
|
+
" is found.",
|
|
198
254
|
" Example: {kind:'openFile', params:{path:'README.md'}}",
|
|
199
255
|
"",
|
|
200
256
|
" openPanel params: { id: string, component: string,",
|
|
@@ -213,11 +269,11 @@ function createExecUiTool(uiBridge, opts = {}) {
|
|
|
213
269
|
" \u2014 Open a plugin-owned target through the workspace",
|
|
214
270
|
" surface resolver registry. Use this when a plugin",
|
|
215
271
|
" defines the mapping from domain target to panel",
|
|
216
|
-
" component, for example a
|
|
272
|
+
" component, for example a catalog row.",
|
|
217
273
|
" Example: {kind:'openSurface', params:{",
|
|
218
|
-
" kind:'
|
|
274
|
+
" kind:'my-plugin.open-row',",
|
|
219
275
|
" target:'orders_daily',",
|
|
220
|
-
" meta:{catalogId:'
|
|
276
|
+
" meta:{catalogId:'my-plugin'}}}",
|
|
221
277
|
"",
|
|
222
278
|
" closePanel params: { id: string }",
|
|
223
279
|
" closeWorkbenchLeftPane params: {}",
|
|
@@ -386,7 +442,11 @@ function uiRoutes(app, opts, done) {
|
|
|
386
442
|
async (request, reply) => {
|
|
387
443
|
const body = request.body;
|
|
388
444
|
const bridge = await resolveBridge(request);
|
|
389
|
-
await bridge.
|
|
445
|
+
const current = await bridge.getState() ?? {};
|
|
446
|
+
const preserved = Object.fromEntries(
|
|
447
|
+
(opts.preserveStateKeys ?? []).filter((key) => !(key in body.state) && key in current).map((key) => [key, current[key]])
|
|
448
|
+
);
|
|
449
|
+
await bridge.setState({ ...body.state, ...preserved });
|
|
390
450
|
return reply.code(204).send();
|
|
391
451
|
}
|
|
392
452
|
);
|
|
@@ -599,6 +659,11 @@ function validateServerPlugin(plugin) {
|
|
|
599
659
|
if (plugin.routes !== void 0 && typeof plugin.routes !== "function") {
|
|
600
660
|
fail(plugin.id, "routes must be a Fastify plugin function when provided");
|
|
601
661
|
}
|
|
662
|
+
if (plugin.preservedUiStateKeys !== void 0) {
|
|
663
|
+
if (!Array.isArray(plugin.preservedUiStateKeys) || plugin.preservedUiStateKeys.some((key) => typeof key !== "string" || key.length === 0)) {
|
|
664
|
+
fail(plugin.id, "preservedUiStateKeys must be a non-empty string array when provided");
|
|
665
|
+
}
|
|
666
|
+
}
|
|
602
667
|
if (plugin.provisioning !== void 0) {
|
|
603
668
|
validateProvisioning(plugin.id, plugin.provisioning);
|
|
604
669
|
}
|
|
@@ -654,6 +719,10 @@ function composeServerPlugins(options) {
|
|
|
654
719
|
...options.plugins.map((plugin) => plugin.routes),
|
|
655
720
|
options.routes
|
|
656
721
|
]);
|
|
722
|
+
const preservedUiStateKeys = [.../* @__PURE__ */ new Set([
|
|
723
|
+
...options.plugins.flatMap((plugin) => plugin.preservedUiStateKeys ?? []),
|
|
724
|
+
...options.preservedUiStateKeys ?? []
|
|
725
|
+
])];
|
|
657
726
|
return defineServerPlugin({
|
|
658
727
|
id: options.id,
|
|
659
728
|
...options.label !== void 0 ? { label: options.label } : {},
|
|
@@ -661,7 +730,8 @@ function composeServerPlugins(options) {
|
|
|
661
730
|
...systemPrompt ? { systemPrompt } : {},
|
|
662
731
|
...agentTools.length > 0 ? { agentTools } : {},
|
|
663
732
|
...provisioning ? { provisioning } : {},
|
|
664
|
-
...routes ? { routes } : {}
|
|
733
|
+
...routes ? { routes } : {},
|
|
734
|
+
...preservedUiStateKeys.length > 0 ? { preservedUiStateKeys } : {}
|
|
665
735
|
});
|
|
666
736
|
}
|
|
667
737
|
|
|
@@ -693,13 +763,15 @@ function bootstrapServer(options) {
|
|
|
693
763
|
const piPackages = collectPiPackages(finalPlugins);
|
|
694
764
|
const provisioningContributions = finalPlugins.filter((p) => p.provisioning).map((p) => ({ id: p.id, provisioning: p.provisioning }));
|
|
695
765
|
const routeContributions = finalPlugins.filter((p) => p.routes).map((p) => ({ id: p.id, routes: p.routes }));
|
|
766
|
+
const preservedUiStateKeys = [...new Set(finalPlugins.flatMap((p) => p.preservedUiStateKeys ?? []))];
|
|
696
767
|
return {
|
|
697
768
|
registered: finalPlugins.map((p) => p.id),
|
|
698
769
|
systemPromptAppend,
|
|
699
770
|
piPackages,
|
|
700
771
|
agentTools,
|
|
701
772
|
provisioningContributions,
|
|
702
|
-
routeContributions
|
|
773
|
+
routeContributions,
|
|
774
|
+
preservedUiStateKeys
|
|
703
775
|
};
|
|
704
776
|
}
|
|
705
777
|
|
|
@@ -719,12 +791,13 @@ function collectWorkspaceAgentServerPlugins(opts = {}) {
|
|
|
719
791
|
plugins: opts.plugins,
|
|
720
792
|
excludeDefaults: opts.excludeDefaults
|
|
721
793
|
});
|
|
722
|
-
const workspaceSkillsDir =
|
|
794
|
+
const workspaceSkillsDir = join2(workspaceRoot, ".agents", "skills");
|
|
723
795
|
const callerAdditional = opts.resourceLoaderOptions?.additionalSkillPaths ?? [];
|
|
724
796
|
const callerPiPackages = opts.resourceLoaderOptions?.piPackages ?? [];
|
|
725
797
|
return {
|
|
726
798
|
provisioningContributions: result.provisioningContributions,
|
|
727
799
|
routeContributions: result.routeContributions,
|
|
800
|
+
preservedUiStateKeys: result.preservedUiStateKeys,
|
|
728
801
|
agentOptions: {
|
|
729
802
|
extraTools: result.agentTools,
|
|
730
803
|
systemPromptAppend: [opts.systemPromptAppend, result.systemPromptAppend].filter(Boolean).join("\n\n") || void 0,
|
|
@@ -747,11 +820,17 @@ async function provisionWorkspaceAgentServer(opts) {
|
|
|
747
820
|
async function createWorkspaceAgentServer(opts = {}) {
|
|
748
821
|
const workspaceRoot = opts.workspaceRoot ?? process.cwd();
|
|
749
822
|
const bridge = createInMemoryBridge();
|
|
750
|
-
const
|
|
823
|
+
const resolvedMode = opts.runtimeModeAdapter?.id ?? opts.mode ?? autoDetectMode();
|
|
824
|
+
const workspaceFsCapability = opts.runtimeModeAdapter ? opts.runtimeModeAdapter.workspaceFsCapability ?? "best-effort" : resolveMode(resolvedMode).workspaceFsCapability ?? "best-effort";
|
|
825
|
+
const validateUiPaths = opts.validateUiPaths ?? workspaceFsCapability === "strong";
|
|
751
826
|
const uiTools = createWorkspaceUiTools(bridge, {
|
|
752
827
|
workspaceRoot: validateUiPaths ? workspaceRoot : void 0
|
|
753
828
|
});
|
|
754
|
-
const
|
|
829
|
+
const factoryPlugins = opts.pluginFactories?.map((factory) => factory({ workspaceRoot, bridge })) ?? [];
|
|
830
|
+
const pluginCollection = collectWorkspaceAgentServerPlugins({
|
|
831
|
+
...opts,
|
|
832
|
+
plugins: [...opts.plugins ?? [], ...factoryPlugins]
|
|
833
|
+
});
|
|
755
834
|
if (opts.provisionWorkspace !== false) {
|
|
756
835
|
await provisionWorkspaceAgentServer({
|
|
757
836
|
workspaceRoot,
|
|
@@ -761,6 +840,7 @@ async function createWorkspaceAgentServer(opts = {}) {
|
|
|
761
840
|
}
|
|
762
841
|
const app = await createAgentApp({
|
|
763
842
|
...opts,
|
|
843
|
+
mode: resolvedMode,
|
|
764
844
|
workspaceRoot,
|
|
765
845
|
extraTools: [
|
|
766
846
|
...opts.extraTools ?? [],
|
|
@@ -768,18 +848,20 @@ async function createWorkspaceAgentServer(opts = {}) {
|
|
|
768
848
|
...pluginCollection.agentOptions.extraTools ?? []
|
|
769
849
|
],
|
|
770
850
|
systemPromptAppend: [
|
|
771
|
-
|
|
851
|
+
workspaceFsCapability === "strong" ? buildWorkspaceContextPrompt() : void 0,
|
|
852
|
+
buildBoringSystemPrompt(),
|
|
772
853
|
pluginCollection.agentOptions.systemPromptAppend
|
|
773
854
|
].filter(Boolean).join("\n\n") || void 0,
|
|
774
855
|
resourceLoaderOptions: pluginCollection.agentOptions.resourceLoaderOptions
|
|
775
856
|
});
|
|
776
|
-
await app.register(uiRoutes, { bridge });
|
|
857
|
+
await app.register(uiRoutes, { bridge, preserveStateKeys: pluginCollection.preservedUiStateKeys });
|
|
777
858
|
for (const { routes } of pluginCollection.routeContributions) {
|
|
778
859
|
await app.register(routes);
|
|
779
860
|
}
|
|
780
861
|
return app;
|
|
781
862
|
}
|
|
782
863
|
export {
|
|
864
|
+
buildWorkspaceContextPrompt,
|
|
783
865
|
collectWorkspaceAgentServerPlugins,
|
|
784
866
|
composeServerPlugins,
|
|
785
867
|
createWorkspaceAgentServer,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { U as UiBridge, A as AgentTool } from './agent-tool-DEtfQPVB.js';
|
|
1
2
|
import { PiPackageSource, RuntimeProvisioningContribution } from '@hachej/boring-agent/server';
|
|
2
3
|
import { FastifyPluginAsync } from 'fastify';
|
|
3
|
-
|
|
4
|
+
|
|
5
|
+
declare function createInMemoryBridge(): UiBridge;
|
|
4
6
|
|
|
5
7
|
interface WorkspaceServerPlugin {
|
|
6
8
|
id: string;
|
|
@@ -15,6 +17,8 @@ interface WorkspaceServerPlugin {
|
|
|
15
17
|
agentTools?: AgentTool[];
|
|
16
18
|
provisioning?: RuntimeProvisioningContribution;
|
|
17
19
|
routes?: FastifyPluginAsync;
|
|
20
|
+
/** UI state keys owned by this plugin that browser state PUTs must not overwrite. */
|
|
21
|
+
preservedUiStateKeys?: string[];
|
|
18
22
|
}
|
|
19
23
|
declare class ServerPluginError extends Error {
|
|
20
24
|
constructor(message: string);
|
|
@@ -31,6 +35,7 @@ interface ComposeServerPluginsOptions {
|
|
|
31
35
|
agentTools?: AgentTool[];
|
|
32
36
|
provisioning?: RuntimeProvisioningContribution;
|
|
33
37
|
routes?: FastifyPluginAsync;
|
|
38
|
+
preservedUiStateKeys?: string[];
|
|
34
39
|
}
|
|
35
40
|
/**
|
|
36
41
|
* Compose a server plugin from smaller server plugin fragments. Child
|
|
@@ -60,7 +65,8 @@ interface ServerBootstrapResult {
|
|
|
60
65
|
agentTools: AgentTool[];
|
|
61
66
|
provisioningContributions: WorkspaceProvisioningContribution[];
|
|
62
67
|
routeContributions: WorkspaceRouteContribution[];
|
|
68
|
+
preservedUiStateKeys: string[];
|
|
63
69
|
}
|
|
64
70
|
declare function bootstrapServer(options: ServerBootstrapOptions): ServerBootstrapResult;
|
|
65
71
|
|
|
66
|
-
export { type ComposeServerPluginsOptions as C, type ServerBootstrapOptions as S, type
|
|
72
|
+
export { type ComposeServerPluginsOptions as C, type ServerBootstrapOptions as S, type WorkspaceServerPlugin as W, type WorkspaceProvisioningContribution as a, type WorkspaceRouteContribution as b, createInMemoryBridge as c, composeServerPlugins as d, defineServerPlugin as e, type ServerBootstrapResult as f, ServerPluginError as g, bootstrapServer as h, validateServerPlugin as v };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
export { C as CommandResult, a as UiCommand, b as UiState } from './explorer-DtLUnuah.js';
|
|
1
|
+
export { C as ComposeServerPluginsOptions, S as ServerBootstrapOptions, f as ServerBootstrapResult, g as ServerPluginError, a as WorkspaceProvisioningContribution, b as WorkspaceRouteContribution, W as WorkspaceServerPlugin, h as bootstrapServer, d as composeServerPlugins, c as createInMemoryBridge, e as defineServerPlugin, v as validateServerPlugin } from './bootstrapServer-BreQ9QBc.js';
|
|
3
2
|
import { FastifyRequest, FastifyInstance } from 'fastify';
|
|
4
|
-
import { A as AgentTool } from './agent-tool-
|
|
5
|
-
|
|
6
|
-
export { C as ComposeServerPluginsOptions, S as ServerBootstrapOptions, e as ServerBootstrapResult, f as ServerPluginError, W as WorkspaceProvisioningContribution, a as WorkspaceRouteContribution, g as bootstrapServer, c as composeServerPlugins, d as defineServerPlugin, v as validateServerPlugin } from './bootstrapServer-BRUqUpVW.js';
|
|
3
|
+
import { U as UiBridge, A as AgentTool } from './agent-tool-DEtfQPVB.js';
|
|
4
|
+
export { C as CommandResult, a as UiCommand, b as UiState } from './agent-tool-DEtfQPVB.js';
|
|
7
5
|
export { PiPackageSource as WorkspacePiPackageSource } from '@hachej/boring-agent/server';
|
|
8
6
|
|
|
9
|
-
declare function createInMemoryBridge(): UiBridge;
|
|
10
|
-
|
|
11
7
|
interface UiRoutesOptions {
|
|
12
8
|
bridge?: UiBridge;
|
|
13
9
|
getBridge?: (request: FastifyRequest) => UiBridge | Promise<UiBridge>;
|
|
10
|
+
/**
|
|
11
|
+
* Server/plugin-owned state slots preserved across browser full-state PUTs.
|
|
12
|
+
* Browser UI snapshots are replace-style for normal workspace state, but
|
|
13
|
+
* these slots are published out-of-band by server plugins.
|
|
14
|
+
*/
|
|
15
|
+
preserveStateKeys?: string[];
|
|
14
16
|
}
|
|
15
17
|
declare function uiRoutes(app: FastifyInstance, opts: UiRoutesOptions, done: (err?: Error) => void): void;
|
|
16
18
|
|
|
@@ -21,9 +23,9 @@ interface ExecUiToolOptions {
|
|
|
21
23
|
* tool stat-checks the resolved path before queueing the UI command and
|
|
22
24
|
* returns an error to the agent if the file is missing or escapes the
|
|
23
25
|
* root — so the model gets immediate feedback instead of the frontend
|
|
24
|
-
* silently no-op'ing on a wrong path. When omitted
|
|
25
|
-
*
|
|
26
|
-
* filesystem
|
|
26
|
+
* silently no-op'ing on a wrong path. When omitted (for example, remote
|
|
27
|
+
* sandbox filesystems the host cannot stat), path syntax is still validated
|
|
28
|
+
* but existence is left to the frontend/remote filesystem.
|
|
27
29
|
*/
|
|
28
30
|
workspaceRoot?: string;
|
|
29
31
|
/**
|
|
@@ -57,28 +59,4 @@ declare function createExecUiTool(uiBridge: UiBridge, opts?: ExecUiToolOptions):
|
|
|
57
59
|
*/
|
|
58
60
|
declare function createWorkspaceUiTools(uiBridge: UiBridge, opts?: ExecUiToolOptions): AgentTool[];
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
name?: string;
|
|
62
|
-
label?: string;
|
|
63
|
-
adapter: ExplorerAdapter;
|
|
64
|
-
defaultLimit?: number;
|
|
65
|
-
maxLimit?: number;
|
|
66
|
-
}
|
|
67
|
-
interface DataCatalogSkillOptions {
|
|
68
|
-
label?: string;
|
|
69
|
-
toolName?: string;
|
|
70
|
-
surfaceKind?: string;
|
|
71
|
-
guidance?: string;
|
|
72
|
-
}
|
|
73
|
-
interface DataCatalogServerPluginOptions extends DataCatalogAgentToolOptions, DataCatalogSkillOptions {
|
|
74
|
-
id?: string;
|
|
75
|
-
}
|
|
76
|
-
declare function formatDataCatalogSearchResult(query: string, result: SearchResult): string;
|
|
77
|
-
declare function createDataCatalogAgentTool(options: DataCatalogAgentToolOptions): AgentTool;
|
|
78
|
-
declare function createDataCatalogSkillPrompt(options?: DataCatalogSkillOptions): string;
|
|
79
|
-
declare function createDataCatalogServerPlugin(options: DataCatalogServerPluginOptions): WorkspaceServerPlugin & {
|
|
80
|
-
agentTools: AgentTool[];
|
|
81
|
-
systemPrompt: string;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export { type DataCatalogAgentToolOptions, type DataCatalogServerPluginOptions, type DataCatalogSkillOptions, UiBridge, type UiRoutesOptions, WorkspaceServerPlugin, createDataCatalogAgentTool, createDataCatalogServerPlugin, createDataCatalogSkillPrompt, createExecUiTool, createGetUiStateTool, createInMemoryBridge, createWorkspaceUiTools, formatDataCatalogSearchResult, uiRoutes };
|
|
62
|
+
export { UiBridge, type UiRoutesOptions, createExecUiTool, createGetUiStateTool, createWorkspaceUiTools, uiRoutes };
|