@hachej/boring-workspace 0.1.0

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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +94 -0
  3. package/dist/CodeEditor-DQqOn4xz.js +266 -0
  4. package/dist/CommandPalette-aM61U-b0.js +5229 -0
  5. package/dist/FileTree-DRq_bfue.js +245 -0
  6. package/dist/MarkdownEditor-DjiHxnRv.js +349 -0
  7. package/dist/WorkspaceLoadingState-By0dZoPD.js +568 -0
  8. package/dist/agent-tool-NvxKfist.d.ts +28 -0
  9. package/dist/app-front.d.ts +485 -0
  10. package/dist/app-front.js +452 -0
  11. package/dist/app-server.d.ts +53 -0
  12. package/dist/app-server.js +769 -0
  13. package/dist/bootstrapServer-BRUqUpVW.d.ts +66 -0
  14. package/dist/boring-workspace.css +1 -0
  15. package/dist/charts.d.ts +114 -0
  16. package/dist/charts.js +143 -0
  17. package/dist/events.d.ts +178 -0
  18. package/dist/events.js +88 -0
  19. package/dist/explorer-DtLUnuah.d.ts +129 -0
  20. package/dist/panel-DnvDNQac.js +6 -0
  21. package/dist/server.d.ts +84 -0
  22. package/dist/server.js +811 -0
  23. package/dist/shared.d.ts +113 -0
  24. package/dist/shared.js +11 -0
  25. package/dist/testing-e2e.d.ts +68 -0
  26. package/dist/testing-e2e.js +45 -0
  27. package/dist/testing.d.ts +464 -0
  28. package/dist/testing.js +10984 -0
  29. package/dist/utils-B6yFEsav.js +8 -0
  30. package/dist/workspace.css +5780 -0
  31. package/dist/workspace.d.ts +2119 -0
  32. package/dist/workspace.js +1884 -0
  33. package/docs/INTERFACES.md +58 -0
  34. package/docs/PLUGIN_STRUCTURE.md +162 -0
  35. package/docs/README.md +19 -0
  36. package/docs/bridge.md +135 -0
  37. package/docs/panels.md +102 -0
  38. package/docs/plans/GENERIC_EXPLORER_PLUGIN_PLAN.md +455 -0
  39. package/docs/plans/MACRO_PLUGIN_GENERIC_HELPERS_AUDIT.md +962 -0
  40. package/docs/plans/PLUGIN_OUTPUTS_ISOLATION_PLAN.md +301 -0
  41. package/docs/plans/README.md +9 -0
  42. package/docs/plans/UI_BRIDGE_OWNERSHIP_REFACTOR.md +303 -0
  43. package/docs/plans/archive/CODE_OWNERSHIP_CLEANUP_PLAN.md +387 -0
  44. package/docs/plans/archive/COMMAND_PALETTE_REGISTRY.md +814 -0
  45. package/docs/plans/archive/DECLARATIVE_LAYOUT_MIGRATION.md +277 -0
  46. package/docs/plans/archive/PLUGIN_MODEL.md +3674 -0
  47. package/docs/plans/archive/SRC_FOLDER_REORG_PLAN.md +307 -0
  48. package/docs/plans/archive/UNIFIED_EVENT_BUS.md +647 -0
  49. package/docs/plans/archive/WORKSPACE_V2_PLAN.md +2489 -0
  50. package/docs/plugins.md +158 -0
  51. package/package.json +164 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 boringdata
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # @boring/workspace
2
+
3
+ Plugin system, panel registry, and IDE-style layout for boring-ui apps.
4
+
5
+ ```bash
6
+ pnpm add @boring/workspace
7
+ ```
8
+
9
+ ---
10
+
11
+ ## What it provides
12
+
13
+ - **Plugin system** — contribute panels, commands, catalogs, sidebar tabs, and surface resolvers
14
+ - **Layouts** — `ChatLayout`, `IdeLayout`, `ResponsiveDockviewShell`
15
+ - **Panel registry** — auto-lazy code splitting, error boundaries, dockview integration
16
+ - **Bridge** — typed pubsub between agent backend and frontend panels
17
+ - **Built-in plugins** — file tree, editor, artifact surface, command palette
18
+
19
+ ---
20
+
21
+ ## Quickstart
22
+
23
+ ```tsx
24
+ import { WorkspaceProvider, IdeLayout } from "@boring/workspace"
25
+ import { ChatPanel } from "@boring/agent"
26
+
27
+ export function App() {
28
+ return (
29
+ <WorkspaceProvider chatPanel={ChatPanel} plugins={[myPlugin]}>
30
+ <IdeLayout />
31
+ </WorkspaceProvider>
32
+ )
33
+ }
34
+ ```
35
+
36
+ ---
37
+
38
+ ## Writing a plugin
39
+
40
+ ```ts
41
+ import { defineFrontPlugin, definePanel } from "@boring/workspace"
42
+
43
+ export const myPlugin = defineFrontPlugin({
44
+ id: "my-plugin",
45
+ label: "My Plugin",
46
+ systemPrompt: "You can open widgets with the 'open-widget' tool.",
47
+ outputs: [
48
+ {
49
+ type: "panel",
50
+ panel: definePanel({
51
+ id: "my-widget",
52
+ title: "Widget",
53
+ placement: "center",
54
+ component: () => import("./WidgetPane").then(m => ({ default: m.WidgetPane })),
55
+ }),
56
+ },
57
+ ],
58
+ })
59
+ ```
60
+
61
+ Panel components receive `PaneProps<T>`:
62
+
63
+ ```ts
64
+ import type { PaneProps } from "@boring/workspace"
65
+
66
+ export function WidgetPane({ params, api }: PaneProps<{ id: string }>) {
67
+ // params — data passed when the panel is opened
68
+ // api — DockviewPanelApi (close, setTitle, …)
69
+ }
70
+ ```
71
+
72
+ Panels are auto-lazy: a zero-arg factory `() => import(...)` is code-split automatically.
73
+
74
+ ---
75
+
76
+ ## Output types
77
+
78
+ | type | contributes |
79
+ |---|---|
80
+ | `panel` | a center/right/bottom pane |
81
+ | `left-tab` | a persistent sidebar tab |
82
+ | `command` | a command palette entry |
83
+ | `catalog` | a searchable data explorer |
84
+ | `surface-resolver` | maps agent `exec_ui` calls to panel opens |
85
+
86
+ ---
87
+
88
+ ## Part of [boring-ui](https://github.com/hachej/boring-ui)
89
+
90
+ | Package | Role |
91
+ |---|---|
92
+ | `@boring/core` | DB, auth, app factory |
93
+ | `@boring/workspace` | Plugin system, layouts |
94
+ | `@boring/agent` | Agent runtime + tools |
@@ -0,0 +1,266 @@
1
+ import { jsxs as j, jsx as f } from "react/jsx-runtime";
2
+ import { useRef as c, useMemo as K, useEffect as l } from "react";
3
+ import { Compartment as s, EditorState as y } from "@codemirror/state";
4
+ import { EditorView as u, lineNumbers as N, drawSelection as T, highlightActiveLine as A, keymap as U } from "@codemirror/view";
5
+ import { history as W, defaultKeymap as z, historyKeymap as G } from "@codemirror/commands";
6
+ import { javascript as O } from "@codemirror/lang-javascript";
7
+ import { python as I } from "@codemirror/lang-python";
8
+ import { json as q } from "@codemirror/lang-json";
9
+ import { yaml as P } from "@codemirror/lang-yaml";
10
+ import { markdown as V } from "@codemirror/lang-markdown";
11
+ import { sql as J } from "@codemirror/lang-sql";
12
+ import { syntaxHighlighting as H, HighlightStyle as Q, bracketMatching as X, indentOnInput as Y, foldGutter as Z, foldKeymap as $, defaultHighlightStyle as ee } from "@codemirror/language";
13
+ import { highlightSelectionMatches as re, searchKeymap as te } from "@codemirror/search";
14
+ import { Button as oe } from "@hachej/boring-ui-kit";
15
+ import { tags as e } from "@lezer/highlight";
16
+ import { c as R } from "./utils-B6yFEsav.js";
17
+ const ce = Q.define([
18
+ { tag: e.keyword, color: "oklch(0.7 0.15 300)" },
19
+ { tag: [e.name, e.deleted, e.character, e.macroName], color: "var(--foreground)" },
20
+ { tag: [e.function(e.variableName), e.labelName], color: "oklch(0.75 0.15 210)" },
21
+ { tag: [e.color, e.constant(e.name), e.standard(e.name)], color: "oklch(0.75 0.12 60)" },
22
+ { tag: [e.definition(e.name), e.separator], color: "var(--foreground)" },
23
+ { tag: [e.typeName, e.className, e.number, e.changed, e.annotation, e.modifier, e.self, e.namespace], color: "oklch(0.75 0.12 60)" },
24
+ { tag: [e.operator, e.operatorKeyword, e.url, e.escape, e.regexp, e.link, e.special(e.string)], color: "oklch(0.7 0.12 180)" },
25
+ { tag: [e.meta, e.comment], color: "var(--muted-foreground)" },
26
+ { tag: e.strong, fontWeight: "bold" },
27
+ { tag: e.emphasis, fontStyle: "italic" },
28
+ { tag: e.strikethrough, textDecoration: "line-through" },
29
+ { tag: e.link, color: "oklch(0.7 0.12 180)", textDecoration: "underline" },
30
+ { tag: e.heading, fontWeight: "bold", color: "oklch(0.75 0.15 210)" },
31
+ { tag: [e.atom, e.bool, e.special(e.variableName)], color: "oklch(0.75 0.12 60)" },
32
+ { tag: [e.processingInstruction, e.string, e.inserted], color: "oklch(0.75 0.12 140)" },
33
+ { tag: e.invalid, color: "var(--destructive)" }
34
+ ]);
35
+ function D(o) {
36
+ return [u.theme(
37
+ {
38
+ "&": {
39
+ backgroundColor: "transparent",
40
+ color: "var(--foreground)",
41
+ height: "100%"
42
+ },
43
+ ".cm-content": {
44
+ caretColor: "var(--foreground)",
45
+ fontFamily: "var(--font-mono, ui-monospace, monospace)"
46
+ },
47
+ ".cm-gutters": {
48
+ backgroundColor: "transparent",
49
+ color: "oklch(from var(--muted-foreground) l c h / 0.55)",
50
+ borderRight: "none",
51
+ paddingRight: "12px"
52
+ },
53
+ ".cm-lineNumbers .cm-gutterElement": {
54
+ padding: "0 6px 0 12px",
55
+ fontVariantNumeric: "tabular-nums",
56
+ fontSize: "12px"
57
+ },
58
+ ".cm-activeLineGutter": {
59
+ backgroundColor: "oklch(from var(--accent) l c h / 0.05)",
60
+ color: "var(--foreground)"
61
+ },
62
+ ".cm-activeLine": {
63
+ backgroundColor: "oklch(from var(--accent) l c h / 0.04)"
64
+ },
65
+ "&.cm-focused .cm-cursor": {
66
+ borderLeftColor: "var(--accent)"
67
+ },
68
+ ".cm-selectionBackground, &.cm-focused .cm-selectionBackground": {
69
+ backgroundColor: "oklch(from var(--accent) l c h / 0.16)"
70
+ },
71
+ ".cm-panels": {
72
+ backgroundColor: "var(--muted)",
73
+ color: "var(--foreground)"
74
+ },
75
+ ".cm-panels.cm-panels-top": {
76
+ borderBottom: "1px solid var(--border)"
77
+ },
78
+ ".cm-panels.cm-panels-bottom": {
79
+ borderTop: "1px solid var(--border)"
80
+ },
81
+ ".cm-searchMatch": {
82
+ backgroundColor: "oklch(0.8 0.15 80 / 0.3)",
83
+ outline: "1px solid oklch(0.8 0.15 80 / 0.5)"
84
+ },
85
+ ".cm-searchMatch.cm-searchMatch-selected": {
86
+ backgroundColor: "oklch(0.7 0.15 80 / 0.5)"
87
+ },
88
+ ".cm-tooltip": {
89
+ backgroundColor: "var(--popover)",
90
+ color: "var(--popover-foreground)",
91
+ border: "1px solid var(--border)",
92
+ borderRadius: "var(--radius-sm, 4px)"
93
+ },
94
+ ".cm-tooltip-autocomplete": {
95
+ "& > ul > li[aria-selected]": {
96
+ backgroundColor: "var(--accent)",
97
+ color: "var(--accent-foreground)"
98
+ }
99
+ },
100
+ ".cm-foldPlaceholder": {
101
+ backgroundColor: "var(--muted)",
102
+ border: "1px solid var(--border)",
103
+ color: "var(--muted-foreground)"
104
+ }
105
+ },
106
+ { dark: (o == null ? void 0 : o.dark) ?? !1 }
107
+ ), H(ce)];
108
+ }
109
+ const ne = 1e6, ae = 1e7;
110
+ function M(o) {
111
+ switch (o) {
112
+ case "javascript":
113
+ case "js":
114
+ case "jsx":
115
+ return O({ jsx: !0 });
116
+ case "typescript":
117
+ case "ts":
118
+ case "tsx":
119
+ return O({ jsx: !0, typescript: !0 });
120
+ case "python":
121
+ case "py":
122
+ return I();
123
+ case "json":
124
+ return q();
125
+ case "yaml":
126
+ case "yml":
127
+ return P();
128
+ case "markdown":
129
+ case "md":
130
+ return V();
131
+ case "sql":
132
+ return J();
133
+ default:
134
+ return null;
135
+ }
136
+ }
137
+ function le({
138
+ content: o,
139
+ onChange: p,
140
+ language: g = "typescript",
141
+ readOnly: _ = !1,
142
+ lineNumbers: h = !0,
143
+ wordWrap: v = !1,
144
+ className: w
145
+ }) {
146
+ const d = c(null), n = c(null), m = c(p);
147
+ m.current = p;
148
+ const b = c(!1), k = c(new s()), C = c(new s()), L = c(new s()), E = c(new s()), S = c(new s()), i = o.length >= ne, B = o.length >= ae, x = _ || i, F = K(() => {
149
+ const r = [
150
+ C.current.of(y.readOnly.of(x)),
151
+ L.current.of(h ? N() : []),
152
+ E.current.of(v ? u.lineWrapping : []),
153
+ T(),
154
+ A(),
155
+ X(),
156
+ Y(),
157
+ W(),
158
+ re(),
159
+ Z(),
160
+ U.of([...z, ...G, ...$, ...te]),
161
+ S.current.of(D()),
162
+ H(ee, { fallback: !0 })
163
+ ];
164
+ if (i)
165
+ r.push(k.current.of([]));
166
+ else {
167
+ const t = M(g);
168
+ r.push(k.current.of(t ?? []));
169
+ }
170
+ return r.push(
171
+ u.updateListener.of((t) => {
172
+ var a;
173
+ t.docChanged && !b.current && ((a = m.current) == null || a.call(m, t.state.doc.toString()));
174
+ })
175
+ ), r;
176
+ }, []);
177
+ return l(() => {
178
+ if (!d.current) return;
179
+ const r = y.create({ doc: o, extensions: F }), t = new u({ state: r, parent: d.current });
180
+ return n.current = t, () => {
181
+ t.destroy(), n.current = null;
182
+ };
183
+ }, []), l(() => {
184
+ const r = n.current;
185
+ if (!r) return;
186
+ const t = r.state.doc.toString();
187
+ t !== o && (b.current = !0, r.dispatch({
188
+ changes: { from: 0, to: t.length, insert: o }
189
+ }), b.current = !1);
190
+ }, [o]), l(() => {
191
+ const r = n.current;
192
+ r && r.dispatch({
193
+ effects: C.current.reconfigure(
194
+ y.readOnly.of(x)
195
+ )
196
+ });
197
+ }, [x]), l(() => {
198
+ const r = n.current;
199
+ r && r.dispatch({
200
+ effects: L.current.reconfigure(
201
+ h ? N() : []
202
+ )
203
+ });
204
+ }, [h]), l(() => {
205
+ const r = n.current;
206
+ r && r.dispatch({
207
+ effects: E.current.reconfigure(
208
+ v ? u.lineWrapping : []
209
+ )
210
+ });
211
+ }, [v]), l(() => {
212
+ const r = n.current;
213
+ if (!r || i) return;
214
+ const t = M(g);
215
+ r.dispatch({
216
+ effects: k.current.reconfigure(t ?? [])
217
+ });
218
+ }, [g, i]), l(() => {
219
+ const r = new MutationObserver(() => {
220
+ const t = n.current;
221
+ if (!t) return;
222
+ const a = document.documentElement.getAttribute("data-theme") === "dark";
223
+ t.dispatch({
224
+ effects: S.current.reconfigure(D({ dark: a }))
225
+ });
226
+ });
227
+ return r.observe(document.documentElement, {
228
+ attributes: !0,
229
+ attributeFilter: ["data-theme"]
230
+ }), () => r.disconnect();
231
+ }, []), i ? /* @__PURE__ */ j("div", { className: R("flex h-full flex-col", w), children: [
232
+ /* @__PURE__ */ j("div", { className: "flex items-center gap-2 border-b border-border bg-muted/50 px-3 py-2 text-sm text-muted-foreground", children: [
233
+ /* @__PURE__ */ f("span", { children: "Large file — editing disabled" }),
234
+ B && /* @__PURE__ */ f(
235
+ oe,
236
+ {
237
+ type: "button",
238
+ variant: "outline",
239
+ size: "xs",
240
+ className: "ml-auto",
241
+ onClick: () => {
242
+ const r = new Blob([o], { type: "text/plain" }), t = URL.createObjectURL(r), a = document.createElement("a");
243
+ a.href = t, a.download = "file.txt", a.click(), URL.revokeObjectURL(t);
244
+ },
245
+ children: "Download"
246
+ }
247
+ )
248
+ ] }),
249
+ /* @__PURE__ */ f("div", { ref: d, className: "flex-1 overflow-hidden" })
250
+ ] }) : /* @__PURE__ */ f(
251
+ "div",
252
+ {
253
+ ref: d,
254
+ className: R("h-full overflow-hidden", w)
255
+ }
256
+ );
257
+ }
258
+ const Le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
259
+ __proto__: null,
260
+ CodeEditor: le
261
+ }, Symbol.toStringTag, { value: "Module" }));
262
+ export {
263
+ le as C,
264
+ Le as a,
265
+ D as c
266
+ };