fluxplugin 1.0.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 (70) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +50 -0
  3. package/dist/browser/chunks/chunk-Q75AOCXD.js +2544 -0
  4. package/dist/browser/chunks/chunk-ZZ25CRMR.js +759 -0
  5. package/dist/browser/index.js +138 -0
  6. package/dist/browser/manager-ui.js +165 -0
  7. package/dist/browser/react.js +73 -0
  8. package/dist/cli.js +1635 -0
  9. package/dist/node/chunks/chunk-BZ7NZF7I.js +990 -0
  10. package/dist/node/chunks/chunk-XPLGAEBH.js +2623 -0
  11. package/dist/node/cli-api.js +843 -0
  12. package/dist/node/index.js +138 -0
  13. package/dist/node/main.js +61 -0
  14. package/dist/node/preload.js +56 -0
  15. package/dist/types/cli/bin.d.ts +1 -0
  16. package/dist/types/cli/build.d.ts +7 -0
  17. package/dist/types/cli/cli.d.ts +2 -0
  18. package/dist/types/cli/config.d.ts +9 -0
  19. package/dist/types/cli/host-templates.d.ts +6 -0
  20. package/dist/types/cli/host.d.ts +16 -0
  21. package/dist/types/cli/index.d.ts +6 -0
  22. package/dist/types/cli/shared-modules.d.ts +8 -0
  23. package/dist/types/cli/templates.d.ts +10 -0
  24. package/dist/types/core/api.d.ts +11 -0
  25. package/dist/types/core/common.d.ts +69 -0
  26. package/dist/types/core/deps.d.ts +34 -0
  27. package/dist/types/core/events.d.ts +58 -0
  28. package/dist/types/core/hooks.d.ts +55 -0
  29. package/dist/types/core/index.d.ts +18 -0
  30. package/dist/types/core/ipc.d.ts +148 -0
  31. package/dist/types/core/manager.d.ts +155 -0
  32. package/dist/types/core/manifest.d.ts +88 -0
  33. package/dist/types/core/permissions.d.ts +45 -0
  34. package/dist/types/core/plugin.d.ts +214 -0
  35. package/dist/types/core/protocol.d.ts +86 -0
  36. package/dist/types/core/registry.d.ts +88 -0
  37. package/dist/types/core/routes.d.ts +105 -0
  38. package/dist/types/core/schema.d.ts +99 -0
  39. package/dist/types/core/semver.d.ts +16 -0
  40. package/dist/types/core/slots.d.ts +75 -0
  41. package/dist/types/core/storage.d.ts +55 -0
  42. package/dist/types/core/styles.d.ts +34 -0
  43. package/dist/types/main/adapters.d.ts +81 -0
  44. package/dist/types/main/discover.d.ts +21 -0
  45. package/dist/types/main/framework.d.ts +78 -0
  46. package/dist/types/main/fs-storage.d.ts +33 -0
  47. package/dist/types/main/index.d.ts +8 -0
  48. package/dist/types/main/registry.d.ts +75 -0
  49. package/dist/types/main/security.d.ts +24 -0
  50. package/dist/types/main/serve-web.d.ts +14 -0
  51. package/dist/types/main/tar.d.ts +10 -0
  52. package/dist/types/manager-ui/index.d.ts +7 -0
  53. package/dist/types/preload/index.d.ts +27 -0
  54. package/dist/types/react/base-css.d.ts +2 -0
  55. package/dist/types/react/components.d.ts +89 -0
  56. package/dist/types/react/http-bridge.d.ts +10 -0
  57. package/dist/types/react/index.d.ts +6 -0
  58. package/dist/types/react/palette.d.ts +10 -0
  59. package/dist/types/react/router.d.ts +47 -0
  60. package/dist/types/react/runtime.d.ts +99 -0
  61. package/docs/ARCHITECTURE.md +31 -0
  62. package/docs/PLUGIN-AUTHORS.md +11 -0
  63. package/docs/RELEASE.md +20 -0
  64. package/docs/SECURITY.md +18 -0
  65. package/docs/screenshots/command-palette.png +0 -0
  66. package/docs/screenshots/dashboard.png +0 -0
  67. package/docs/screenshots/plugin-details.png +0 -0
  68. package/docs/screenshots/plugin-manager.png +0 -0
  69. package/docs/screenshots/stats.png +0 -0
  70. package/package.json +112 -0
@@ -0,0 +1,138 @@
1
+ import {
2
+ BUILTIN_PERMISSIONS,
3
+ CHANNELS,
4
+ CommandRegistry,
5
+ DisposableStore,
6
+ EventBus,
7
+ ExtensionPointRegistry,
8
+ FRAMEWORK_ENGINE_KEY,
9
+ FRAMEWORK_VERSION,
10
+ FrameworkError,
11
+ HookCancelledError,
12
+ HookSystem,
13
+ IpcError,
14
+ IpcRegistry,
15
+ LifecycleError,
16
+ LogStore,
17
+ MGMT,
18
+ MemoryStorageBackend,
19
+ MenuRegistry,
20
+ PermissionDeniedError,
21
+ PermissionManager,
22
+ PluginManager,
23
+ PreloadRegistry,
24
+ Registry,
25
+ RouteRegistry,
26
+ ServiceRegistry,
27
+ SlotRegistry,
28
+ StyleRegistry,
29
+ TimeoutError,
30
+ ValidationError,
31
+ activationOrderFor,
32
+ buildDependencyGraph,
33
+ compareVersions,
34
+ createPluginConfig,
35
+ createPluginState,
36
+ createPluginStorage,
37
+ defineCommand,
38
+ defineComponent,
39
+ defineEvent,
40
+ defineHook,
41
+ defineIPC,
42
+ defineIpcContract,
43
+ defineMenu,
44
+ definePlugin,
45
+ defineRoute,
46
+ defineService,
47
+ dependentsOf,
48
+ describeIssue,
49
+ errorMessage,
50
+ hasPluginApi,
51
+ isValidRange,
52
+ isValidVersion,
53
+ manifestSchema,
54
+ matchesPattern,
55
+ menuLocations,
56
+ normalizePath,
57
+ parseOrThrow,
58
+ parseVersion,
59
+ pluginApi,
60
+ preloadMember,
61
+ routePatternMatches,
62
+ s,
63
+ satisfies,
64
+ scopeCss,
65
+ serializeError,
66
+ toDisposable,
67
+ validateManifest,
68
+ withTimeout
69
+ } from "./chunks/chunk-Q75AOCXD.js";
70
+ export {
71
+ BUILTIN_PERMISSIONS,
72
+ CHANNELS,
73
+ CommandRegistry,
74
+ DisposableStore,
75
+ EventBus,
76
+ ExtensionPointRegistry,
77
+ FRAMEWORK_ENGINE_KEY,
78
+ FRAMEWORK_VERSION,
79
+ FrameworkError,
80
+ HookCancelledError,
81
+ HookSystem,
82
+ IpcError,
83
+ IpcRegistry,
84
+ LifecycleError,
85
+ LogStore,
86
+ MGMT,
87
+ MemoryStorageBackend,
88
+ MenuRegistry,
89
+ PermissionDeniedError,
90
+ PermissionManager,
91
+ PluginManager,
92
+ PreloadRegistry,
93
+ Registry,
94
+ RouteRegistry,
95
+ ServiceRegistry,
96
+ SlotRegistry,
97
+ StyleRegistry,
98
+ TimeoutError,
99
+ ValidationError,
100
+ activationOrderFor,
101
+ buildDependencyGraph,
102
+ compareVersions,
103
+ createPluginConfig,
104
+ createPluginState,
105
+ createPluginStorage,
106
+ defineCommand,
107
+ defineComponent,
108
+ defineEvent,
109
+ defineHook,
110
+ defineIPC,
111
+ defineIpcContract,
112
+ defineMenu,
113
+ definePlugin,
114
+ defineRoute,
115
+ defineService,
116
+ dependentsOf,
117
+ describeIssue,
118
+ errorMessage,
119
+ hasPluginApi,
120
+ isValidRange,
121
+ isValidVersion,
122
+ manifestSchema,
123
+ matchesPattern,
124
+ menuLocations,
125
+ normalizePath,
126
+ parseOrThrow,
127
+ parseVersion,
128
+ pluginApi,
129
+ preloadMember,
130
+ routePatternMatches,
131
+ s,
132
+ satisfies,
133
+ scopeCss,
134
+ serializeError,
135
+ toDisposable,
136
+ validateManifest,
137
+ withTimeout
138
+ };
@@ -0,0 +1,165 @@
1
+ import {
2
+ PluginSlot,
3
+ usePluginFramework,
4
+ usePlugins
5
+ } from "./chunks/chunk-ZZ25CRMR.js";
6
+ import "./chunks/chunk-Q75AOCXD.js";
7
+
8
+ // src/manager-ui/index.tsx
9
+ import { useCallback, useEffect, useState } from "react";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ var css = `.fluxm{font:14px system-ui;color:var(--flux-fg,#0f172a)}.fluxm h2{margin:0 0 12px}.fluxm-tabs{display:flex;gap:6px;margin-bottom:12px}
12
+ .fluxm button{cursor:pointer;border:1px solid var(--flux-border,#e2e8f0);background:var(--flux-surface,#f8fafc);color:inherit;border-radius:8px;padding:5px 10px}
13
+ .fluxm button.on{background:var(--flux-accent,#4f46e5);color:#fff;border-color:transparent}.fluxm button.danger{color:#dc2626}
14
+ .fluxm-row{display:flex;align-items:center;gap:10px;padding:10px;border:1px solid var(--flux-border,#e2e8f0);border-radius:10px;margin-bottom:8px}
15
+ .fluxm-grow{flex:1;min-width:0}.fluxm-muted{color:var(--flux-muted,#64748b);font-size:12px}
16
+ .fluxm-badge{font-size:11px;padding:1px 8px;border-radius:99px;background:#e2e8f0;color:#334155}.fluxm-ready{background:#dcfce7;color:#166534}.fluxm-error{background:#fee2e2;color:#991b1b}.fluxm-disabled{background:#f1f5f9;color:#64748b}
17
+ .fluxm-panel{border:1px solid var(--flux-border,#e2e8f0);border-radius:12px;padding:14px;margin-top:12px}.fluxm pre{max-height:180px;overflow:auto;font-size:11px;background:var(--flux-surface,#f8fafc);padding:8px;border-radius:8px}
18
+ .fluxm label{display:flex;gap:8px;align-items:center;margin:6px 0}.fluxm input[type=text],.fluxm input[type=number]{padding:4px 8px;border:1px solid var(--flux-border,#e2e8f0);border-radius:6px}`;
19
+ var badge = (p) => /* @__PURE__ */ jsx("span", { className: `fluxm-badge fluxm-${p.state === "ready" ? "ready" : p.state === "error" ? "error" : p.state === "disabled" ? "disabled" : ""}`, children: p.state });
20
+ function ConfigForm({ id }) {
21
+ const { client } = usePluginFramework();
22
+ const [schema, setSchema] = useState(null);
23
+ const [values, setValues] = useState({});
24
+ const [msg, setMsg] = useState("");
25
+ useEffect(() => {
26
+ client.configSchema(id).then(setSchema).catch(() => setSchema(null));
27
+ client.configGet(id).then(setValues).catch(() => void 0);
28
+ }, [client, id]);
29
+ if (!schema?.properties) return null;
30
+ const save = (patch) => client.configSet(id, patch).then((v) => (setValues(v), setMsg("Saved"))).catch((e) => setMsg(String(e.message)));
31
+ return /* @__PURE__ */ jsxs("div", { className: "fluxm-panel", children: [
32
+ /* @__PURE__ */ jsx("strong", { children: "Settings" }),
33
+ Object.entries(schema.properties).map(([k, d]) => /* @__PURE__ */ jsxs("label", { children: [
34
+ /* @__PURE__ */ jsx("span", { style: { minWidth: 120 }, children: d.title ?? k }),
35
+ d.type === "boolean" ? /* @__PURE__ */ jsx("input", { type: "checkbox", checked: !!values[k], onChange: (e) => save({ [k]: e.target.checked }) }) : d.type === "enum" ? /* @__PURE__ */ jsx("select", { value: values[k] ?? "", onChange: (e) => save({ [k]: e.target.value }), children: d.enum?.map((o) => /* @__PURE__ */ jsx("option", { children: String(o) }, String(o))) }) : /* @__PURE__ */ jsx("input", { type: d.type === "number" ? "number" : "text", value: values[k] ?? "", onChange: (e) => setValues({ ...values, [k]: d.type === "number" ? Number(e.target.value) : e.target.value }), onBlur: () => save({ [k]: values[k] }) })
36
+ ] }, k)),
37
+ /* @__PURE__ */ jsx("div", { className: "fluxm-muted", children: msg }),
38
+ /* @__PURE__ */ jsx("button", { onClick: () => client.configReset(id).then(setValues), children: "Reset to defaults" })
39
+ ] });
40
+ }
41
+ function Details({ p, onClose }) {
42
+ const { client } = usePluginFramework();
43
+ const [logs, setLogs] = useState([]);
44
+ useEffect(() => {
45
+ client.logs(p.id).then(setLogs).catch(() => void 0);
46
+ }, [client, p.id, p.state]);
47
+ return /* @__PURE__ */ jsxs("div", { className: "fluxm-panel", "data-testid": "plugin-details", children: [
48
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between" }, children: [
49
+ /* @__PURE__ */ jsxs("strong", { children: [
50
+ p.name,
51
+ " ",
52
+ /* @__PURE__ */ jsxs("span", { className: "fluxm-muted", children: [
53
+ p.id,
54
+ "@",
55
+ p.version
56
+ ] })
57
+ ] }),
58
+ /* @__PURE__ */ jsx("button", { onClick: onClose, children: "Close" })
59
+ ] }),
60
+ /* @__PURE__ */ jsx("p", { children: p.description }),
61
+ p.error && /* @__PURE__ */ jsxs("p", { className: "fluxm-error fluxm-badge", children: [
62
+ p.error.phase,
63
+ ": ",
64
+ p.error.message
65
+ ] }),
66
+ /* @__PURE__ */ jsx("strong", { children: "Permissions" }),
67
+ p.permissions.declared.length === 0 && /* @__PURE__ */ jsx("div", { className: "fluxm-muted", children: "none requested" }),
68
+ p.permissions.declared.map((perm) => {
69
+ const on = p.permissions.granted.includes(perm);
70
+ return /* @__PURE__ */ jsxs("label", { children: [
71
+ /* @__PURE__ */ jsx("input", { type: "checkbox", checked: on, onChange: () => on ? client.revoke(p.id, perm) : client.grant(p.id, perm) }),
72
+ perm
73
+ ] }, perm);
74
+ }),
75
+ /* @__PURE__ */ jsxs("div", { children: [
76
+ /* @__PURE__ */ jsx("strong", { children: "Dependencies" }),
77
+ " ",
78
+ /* @__PURE__ */ jsx("span", { className: "fluxm-muted", children: Object.entries(p.dependencies).map(([k, v]) => `${k} ${v}`).join(", ") || "none" })
79
+ ] }),
80
+ /* @__PURE__ */ jsxs("div", { children: [
81
+ /* @__PURE__ */ jsx("strong", { children: "Required by" }),
82
+ " ",
83
+ /* @__PURE__ */ jsx("span", { className: "fluxm-muted", children: p.dependents.join(", ") || "nobody" })
84
+ ] }),
85
+ /* @__PURE__ */ jsx(ConfigForm, { id: p.id }),
86
+ /* @__PURE__ */ jsx(PluginSlot, { name: "manager.plugin.details", props: { plugin: p } }),
87
+ /* @__PURE__ */ jsx("strong", { children: "Logs" }),
88
+ /* @__PURE__ */ jsx("pre", { children: logs.map((l) => `${new Date(l.time).toLocaleTimeString()} ${l.level.toUpperCase()} ${l.message}`).join("\n") || "no logs" })
89
+ ] });
90
+ }
91
+ function PluginManagerUI() {
92
+ const { client } = usePluginFramework();
93
+ const plugins = usePlugins();
94
+ const [tab, setTab] = useState("installed");
95
+ const [sel, setSel] = useState();
96
+ const [avail, setAvail] = useState([]);
97
+ const [busy, setBusy] = useState("");
98
+ const wrap = useCallback(async (label, fn) => {
99
+ setBusy(label);
100
+ try {
101
+ await fn();
102
+ } catch (e) {
103
+ alert(e.message);
104
+ } finally {
105
+ setBusy("");
106
+ }
107
+ }, []);
108
+ useEffect(() => {
109
+ if (tab === "available") client.search().then(setAvail).catch(() => setAvail([]));
110
+ if (tab === "updates") client.updates().then(setAvail).catch(() => setAvail([]));
111
+ }, [client, tab]);
112
+ const selected = plugins.find((p) => p.id === sel);
113
+ return /* @__PURE__ */ jsxs("div", { className: "fluxm", children: [
114
+ /* @__PURE__ */ jsx("style", { children: css }),
115
+ /* @__PURE__ */ jsxs("h2", { children: [
116
+ "Plugins ",
117
+ busy && /* @__PURE__ */ jsxs("span", { className: "fluxm-muted", children: [
118
+ busy,
119
+ "\u2026"
120
+ ] })
121
+ ] }),
122
+ /* @__PURE__ */ jsx("div", { className: "fluxm-tabs", children: ["installed", "available", "updates"].map((t) => /* @__PURE__ */ jsx("button", { className: tab === t ? "on" : "", onClick: () => setTab(t), children: t[0].toUpperCase() + t.slice(1) }, t)) }),
123
+ tab === "installed" && plugins.map((p) => /* @__PURE__ */ jsxs("div", { className: "fluxm-row", "data-plugin": p.id, children: [
124
+ /* @__PURE__ */ jsxs("div", { className: "fluxm-grow", children: [
125
+ /* @__PURE__ */ jsx("strong", { children: p.name }),
126
+ " ",
127
+ /* @__PURE__ */ jsxs("span", { className: "fluxm-muted", children: [
128
+ "v",
129
+ p.version
130
+ ] }),
131
+ " ",
132
+ badge(p),
133
+ /* @__PURE__ */ jsx("div", { className: "fluxm-muted", children: p.description })
134
+ ] }),
135
+ /* @__PURE__ */ jsx(PluginSlot, { name: "manager.plugin.actions", props: { plugin: p } }),
136
+ /* @__PURE__ */ jsx("button", { onClick: () => setSel(p.id), children: "Details" }),
137
+ /* @__PURE__ */ jsx("button", { onClick: () => wrap("reloading", () => client.reload(p.id)), children: "Reload" }),
138
+ p.enabled ? /* @__PURE__ */ jsx("button", { onClick: () => wrap("disabling", () => client.disable(p.id)), children: "Disable" }) : /* @__PURE__ */ jsx("button", { className: "on", onClick: () => wrap("enabling", () => client.enable(p.id)), children: "Enable" }),
139
+ /* @__PURE__ */ jsx("button", { className: "danger", onClick: () => confirm(`Uninstall ${p.name}?`) && wrap("uninstalling", () => client.uninstall(p.id)), children: "Uninstall" })
140
+ ] }, p.id)),
141
+ tab !== "installed" && (avail.length === 0 ? /* @__PURE__ */ jsx("div", { className: "fluxm-muted", children: "Nothing here. Configure a registry in the host." }) : avail.map((e) => /* @__PURE__ */ jsxs("div", { className: "fluxm-row", children: [
142
+ /* @__PURE__ */ jsxs("div", { className: "fluxm-grow", children: [
143
+ /* @__PURE__ */ jsx("strong", { children: e.name }),
144
+ " ",
145
+ /* @__PURE__ */ jsxs("span", { className: "fluxm-muted", children: [
146
+ "v",
147
+ e.version,
148
+ " \xB7 ",
149
+ e.source
150
+ ] }),
151
+ /* @__PURE__ */ jsxs("div", { className: "fluxm-muted", children: [
152
+ e.description,
153
+ " \xB7 permissions: ",
154
+ e.permissions.join(", ") || "none"
155
+ ] })
156
+ ] }),
157
+ /* @__PURE__ */ jsx("button", { className: "on", onClick: () => wrap("installing", () => tab === "updates" ? client.update(e) : client.install(e)), children: tab === "updates" ? "Update" : "Install" })
158
+ ] }, e.id + e.version))),
159
+ selected && /* @__PURE__ */ jsx(Details, { p: selected, onClose: () => setSel(void 0) })
160
+ ] });
161
+ }
162
+ export {
163
+ ConfigForm,
164
+ PluginManagerUI
165
+ };
@@ -0,0 +1,73 @@
1
+ import {
2
+ Breadcrumbs,
3
+ CommandPalette,
4
+ HttpBridgeError,
5
+ Link,
6
+ PluginBoundary,
7
+ PluginErrorBoundary,
8
+ PluginProvider,
9
+ PluginRoutes,
10
+ PluginSlot,
11
+ PluginsClient,
12
+ RemoteError,
13
+ RendererFramework,
14
+ StyleHost,
15
+ baseCss,
16
+ buildPluginApis,
17
+ createHttpBridge,
18
+ installSharedModules,
19
+ navigate,
20
+ useExtensionItems,
21
+ useKeybindings,
22
+ useLocation,
23
+ useMenu,
24
+ useNavigate,
25
+ useParams,
26
+ usePlugin,
27
+ usePluginCommand,
28
+ usePluginConfig,
29
+ usePluginEvent,
30
+ usePluginFramework,
31
+ usePluginIPC,
32
+ usePluginRoute,
33
+ usePluginService,
34
+ usePluginState,
35
+ usePlugins
36
+ } from "./chunks/chunk-ZZ25CRMR.js";
37
+ import "./chunks/chunk-Q75AOCXD.js";
38
+ export {
39
+ Breadcrumbs,
40
+ CommandPalette,
41
+ HttpBridgeError,
42
+ Link,
43
+ PluginBoundary,
44
+ PluginErrorBoundary,
45
+ PluginProvider,
46
+ PluginRoutes,
47
+ PluginSlot,
48
+ PluginsClient,
49
+ RemoteError,
50
+ RendererFramework,
51
+ StyleHost,
52
+ baseCss,
53
+ buildPluginApis,
54
+ createHttpBridge,
55
+ installSharedModules,
56
+ navigate,
57
+ useExtensionItems,
58
+ useKeybindings,
59
+ useLocation,
60
+ useMenu,
61
+ useNavigate,
62
+ useParams,
63
+ usePlugin,
64
+ usePluginCommand,
65
+ usePluginConfig,
66
+ usePluginEvent,
67
+ usePluginFramework,
68
+ usePluginIPC,
69
+ usePluginRoute,
70
+ usePluginService,
71
+ usePluginState,
72
+ usePlugins
73
+ };