@decido/shell 4.0.3 → 4.0.4
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/CenterComposite-V3LL23PG.mjs +64 -0
- package/dist/DebugPanel-NFXQOZQ6.mjs +1 -0
- package/dist/MorphShell-4JGDAN46.mjs +1 -0
- package/dist/PlaygroundAppSidebar-QI73PNRI.mjs +1 -0
- package/dist/PlaygroundChat-CBIIQMWU.mjs +1 -0
- package/dist/PlaygroundTerminal-MVZKXTYW.mjs +1 -0
- package/dist/PluginSandbox-MUNBFWGH.mjs +1 -0
- package/dist/ReactFlowEditor-2ALQWCHQ.mjs +6 -0
- package/dist/ReactFlowEditor-ROZ6RF3K.css +1 -0
- package/dist/TimelineEditor-UPRRXXVM.mjs +3 -0
- package/dist/WidgetSlotPanel-YX2VBQAP.mjs +1 -0
- package/dist/chunk-3YEFIKFH.mjs +1 -0
- package/dist/chunk-53FADIUX.mjs +1 -0
- package/dist/chunk-5FWJFDER.mjs +285 -0
- package/dist/chunk-6K3AFDP5.mjs +1 -0
- package/dist/chunk-AGAAZ2MU.mjs +1 -0
- package/dist/chunk-BCP43BRV.mjs +2 -0
- package/dist/chunk-BSJBW64M.mjs +1 -0
- package/dist/chunk-C5FD536O.mjs +1 -0
- package/dist/chunk-DTH34ILQ.mjs +1 -0
- package/dist/chunk-DWP77YZU.mjs +1 -0
- package/dist/chunk-O3OWL3Q2.mjs +1 -0
- package/dist/chunk-POBZMHZ5.mjs +7 -0
- package/dist/chunk-S3AQ4QDD.mjs +42 -0
- package/dist/chunk-XDA6ZRIQ.mjs +1 -0
- package/dist/chunk-XTDMHHMW.mjs +5 -0
- package/dist/chunk-YAYNNUEX.mjs +12 -0
- package/dist/chunk-YEKQJ4YC.mjs +1 -0
- package/dist/chunk-YHFKY5MB.mjs +1 -0
- package/dist/chunk-ZKD74U4X.mjs +1 -0
- package/dist/index.css +1 -561
- package/dist/index.js +462 -65086
- package/dist/index.mjs +50 -40209
- package/dist/useIntentLens-OCAUBNOQ.mjs +1 -0
- package/dist/useSuggestionsStore-Q4KVPU7L.mjs +1 -0
- package/dist/wasm-A4BTVJWV.mjs +1 -0
- package/package.json +15 -15
- package/dist/CenterComposite-RPEGBKQU.mjs +0 -1697
- package/dist/DebugPanel-KEKDMHDN.mjs +0 -14
- package/dist/MorphShell-FKDBB7E5.mjs +0 -14
- package/dist/PlaygroundAppSidebar-ALYJJGAO.mjs +0 -9
- package/dist/PlaygroundChat-MI2KXMK6.mjs +0 -15
- package/dist/PlaygroundTerminal-5AV4BJAI.mjs +0 -7
- package/dist/PluginSandbox-WMNAUQOJ.mjs +0 -188
- package/dist/ReactFlowEditor-RTF2652X.mjs +0 -3574
- package/dist/ReactFlowEditor-ZW5MCN5Y.css +0 -561
- package/dist/TimelineEditor-N4HRMHTB.mjs +0 -226
- package/dist/WidgetSlotPanel-KJI4CHHD.mjs +0 -11
- package/dist/chunk-2YMI4N5I.mjs +0 -2004
- package/dist/chunk-3BZX7LF2.mjs +0 -139
- package/dist/chunk-3P4P3M54.mjs +0 -136
- package/dist/chunk-F3OTFHNO.mjs +0 -40
- package/dist/chunk-IMHORBTL.mjs +0 -48
- package/dist/chunk-JF5QSJYT.mjs +0 -295
- package/dist/chunk-LWMMFTJC.mjs +0 -382
- package/dist/chunk-MSVEFEXE.mjs +0 -179
- package/dist/chunk-OCHGY2MN.mjs +0 -1662
- package/dist/chunk-PMYAM764.mjs +0 -813
- package/dist/chunk-Q64KZXPK.mjs +0 -43
- package/dist/chunk-QHQW2HMU.mjs +0 -155
- package/dist/chunk-RWZ4BOIN.mjs +0 -385
- package/dist/chunk-UHT6FIYF.mjs +0 -195
- package/dist/chunk-UJCSKKID.mjs +0 -30
- package/dist/chunk-V3CYNPGL.mjs +0 -8758
- package/dist/chunk-VBPGEFNM.mjs +0 -2381
- package/dist/chunk-XMSU6UWD.mjs +0 -158
- package/dist/chunk-ZCCCBHE6.mjs +0 -55
- package/dist/useIntentLens-LEQCAXCK.mjs +0 -13
- package/dist/useSuggestionsStore-4L2AIZ2D.mjs +0 -7
- package/dist/wasm-QFXGEYGP.mjs +0 -81
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DebugPanel
|
|
3
|
-
} from "./chunk-VBPGEFNM.mjs";
|
|
4
|
-
import "./chunk-JF5QSJYT.mjs";
|
|
5
|
-
import "./chunk-ZCCCBHE6.mjs";
|
|
6
|
-
import "./chunk-UHT6FIYF.mjs";
|
|
7
|
-
import "./chunk-3BZX7LF2.mjs";
|
|
8
|
-
import "./chunk-MSVEFEXE.mjs";
|
|
9
|
-
import "./chunk-3P4P3M54.mjs";
|
|
10
|
-
import "./chunk-XMSU6UWD.mjs";
|
|
11
|
-
import "./chunk-UJCSKKID.mjs";
|
|
12
|
-
export {
|
|
13
|
-
DebugPanel
|
|
14
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MorphShell
|
|
3
|
-
} from "./chunk-2YMI4N5I.mjs";
|
|
4
|
-
import "./chunk-IMHORBTL.mjs";
|
|
5
|
-
import "./chunk-JF5QSJYT.mjs";
|
|
6
|
-
import "./chunk-ZCCCBHE6.mjs";
|
|
7
|
-
import "./chunk-UHT6FIYF.mjs";
|
|
8
|
-
import "./chunk-MSVEFEXE.mjs";
|
|
9
|
-
import "./chunk-3P4P3M54.mjs";
|
|
10
|
-
import "./chunk-XMSU6UWD.mjs";
|
|
11
|
-
import "./chunk-UJCSKKID.mjs";
|
|
12
|
-
export {
|
|
13
|
-
MorphShell
|
|
14
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PlaygroundChat
|
|
3
|
-
} from "./chunk-OCHGY2MN.mjs";
|
|
4
|
-
import "./chunk-IMHORBTL.mjs";
|
|
5
|
-
import "./chunk-F3OTFHNO.mjs";
|
|
6
|
-
import "./chunk-QHQW2HMU.mjs";
|
|
7
|
-
import "./chunk-UHT6FIYF.mjs";
|
|
8
|
-
import "./chunk-3BZX7LF2.mjs";
|
|
9
|
-
import "./chunk-MSVEFEXE.mjs";
|
|
10
|
-
import "./chunk-3P4P3M54.mjs";
|
|
11
|
-
import "./chunk-XMSU6UWD.mjs";
|
|
12
|
-
import "./chunk-UJCSKKID.mjs";
|
|
13
|
-
export {
|
|
14
|
-
PlaygroundChat
|
|
15
|
-
};
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import "./chunk-UJCSKKID.mjs";
|
|
2
|
-
|
|
3
|
-
// ../sdk/src/sandbox/PluginSandbox.ts
|
|
4
|
-
import { probe, probeStart } from "@decido/logger";
|
|
5
|
-
var PluginSandbox = class {
|
|
6
|
-
worker = null;
|
|
7
|
-
config;
|
|
8
|
-
pendingRequests = /* @__PURE__ */ new Map();
|
|
9
|
-
isReady = false;
|
|
10
|
-
readyPromise;
|
|
11
|
-
readyResolve;
|
|
12
|
-
/** Callbacks for host-side handling */
|
|
13
|
-
onRpcRequest;
|
|
14
|
-
onWidgetRegister;
|
|
15
|
-
onLog;
|
|
16
|
-
onError;
|
|
17
|
-
constructor(config) {
|
|
18
|
-
this.config = config;
|
|
19
|
-
this.readyPromise = new Promise((resolve) => {
|
|
20
|
-
this.readyResolve = resolve;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
/** Start the sandbox Worker and load the plugin */
|
|
24
|
-
async start() {
|
|
25
|
-
const endProbe = probeStart("sandbox.start", { context: { module: "sdk", component: "PluginSandbox" } });
|
|
26
|
-
if (this.config.trusted) {
|
|
27
|
-
this.isReady = true;
|
|
28
|
-
this.readyResolve();
|
|
29
|
-
endProbe({ pluginId: this.config.pluginId, trusted: true });
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const workerUrl = new URL("./sandbox-worker.js", import.meta.url);
|
|
33
|
-
this.worker = new Worker(workerUrl, { type: "module", name: `plugin-${this.config.pluginId}` });
|
|
34
|
-
this.worker.onmessage = (event) => {
|
|
35
|
-
this.handleWorkerMessage(event.data);
|
|
36
|
-
};
|
|
37
|
-
this.worker.onerror = (event) => {
|
|
38
|
-
probe("sandbox.error", { pluginId: this.config.pluginId, error: event.message }, { level: "error", context: { module: "sdk", component: "PluginSandbox" } });
|
|
39
|
-
console.error(`[Sandbox:${this.config.pluginId}] Worker error:`, event.message);
|
|
40
|
-
if (this.onError) this.onError(event.message);
|
|
41
|
-
};
|
|
42
|
-
this.sendToWorker({
|
|
43
|
-
type: "SANDBOX_INIT",
|
|
44
|
-
pluginId: this.config.pluginId,
|
|
45
|
-
payload: {
|
|
46
|
-
pluginUrl: this.config.pluginUrl,
|
|
47
|
-
tenantId: this.config.tenantId,
|
|
48
|
-
permissions: this.config.permissions || []
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
const timeout = this.config.timeout || 1e4;
|
|
52
|
-
await Promise.race([
|
|
53
|
-
this.readyPromise,
|
|
54
|
-
new Promise(
|
|
55
|
-
(_, reject) => setTimeout(() => reject(new Error(`Plugin "${this.config.pluginId}" sandbox init timed out after ${timeout}ms`)), timeout)
|
|
56
|
-
)
|
|
57
|
-
]);
|
|
58
|
-
endProbe({ pluginId: this.config.pluginId, trusted: false });
|
|
59
|
-
}
|
|
60
|
-
/** Request the plugin to mount */
|
|
61
|
-
async mount() {
|
|
62
|
-
if (this.config.trusted) return;
|
|
63
|
-
this.sendToWorker({
|
|
64
|
-
type: "SANDBOX_MOUNT",
|
|
65
|
-
pluginId: this.config.pluginId
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
/** Request the plugin to unmount */
|
|
69
|
-
async unmount() {
|
|
70
|
-
if (this.config.trusted) return;
|
|
71
|
-
this.sendToWorker({
|
|
72
|
-
type: "SANDBOX_UNMOUNT",
|
|
73
|
-
pluginId: this.config.pluginId
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
/** Broadcast an event into the sandbox */
|
|
77
|
-
broadcastEvent(topic, payload) {
|
|
78
|
-
if (!this.worker) return;
|
|
79
|
-
this.sendToWorker({
|
|
80
|
-
type: "SANDBOX_EVENT_BROADCAST",
|
|
81
|
-
pluginId: this.config.pluginId,
|
|
82
|
-
payload: { topic, data: payload }
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
/** Destroy the sandbox — terminates the Worker */
|
|
86
|
-
destroy() {
|
|
87
|
-
probe("sandbox.destroy", { pluginId: this.config.pluginId, pendingRequests: this.pendingRequests.size }, { context: { module: "sdk", component: "PluginSandbox" } });
|
|
88
|
-
if (this.worker) {
|
|
89
|
-
this.sendToWorker({
|
|
90
|
-
type: "SANDBOX_DESTROY",
|
|
91
|
-
pluginId: this.config.pluginId
|
|
92
|
-
});
|
|
93
|
-
setTimeout(() => {
|
|
94
|
-
this.worker?.terminate();
|
|
95
|
-
this.worker = null;
|
|
96
|
-
}, 500);
|
|
97
|
-
}
|
|
98
|
-
for (const [, pending] of this.pendingRequests) {
|
|
99
|
-
clearTimeout(pending.timer);
|
|
100
|
-
pending.reject(new Error("Sandbox destroyed"));
|
|
101
|
-
}
|
|
102
|
-
this.pendingRequests.clear();
|
|
103
|
-
}
|
|
104
|
-
// ── Internal ──
|
|
105
|
-
sendToWorker(message) {
|
|
106
|
-
this.worker?.postMessage(message);
|
|
107
|
-
}
|
|
108
|
-
handleWorkerMessage(msg) {
|
|
109
|
-
switch (msg.type) {
|
|
110
|
-
case "SANDBOX_READY":
|
|
111
|
-
this.isReady = true;
|
|
112
|
-
this.readyResolve();
|
|
113
|
-
break;
|
|
114
|
-
case "SANDBOX_RPC_REQUEST":
|
|
115
|
-
probe("sandbox.rpc.request", { pluginId: msg.pluginId, action: msg.payload?.action }, { context: { module: "sdk", component: "PluginSandbox" }, security: { tier: 1 } });
|
|
116
|
-
this.handleRpcFromPlugin(msg);
|
|
117
|
-
break;
|
|
118
|
-
case "SANDBOX_RPC_RESPONSE":
|
|
119
|
-
this.handleRpcResponse(msg);
|
|
120
|
-
break;
|
|
121
|
-
case "SANDBOX_EVENT_EMIT":
|
|
122
|
-
break;
|
|
123
|
-
case "SANDBOX_WIDGET_REGISTER":
|
|
124
|
-
if (this.onWidgetRegister) {
|
|
125
|
-
this.onWidgetRegister(msg.payload);
|
|
126
|
-
}
|
|
127
|
-
break;
|
|
128
|
-
case "SANDBOX_LOG":
|
|
129
|
-
if (this.onLog) {
|
|
130
|
-
this.onLog(msg.payload?.level || "log", msg.payload?.args || []);
|
|
131
|
-
} else {
|
|
132
|
-
const level = msg.payload?.level || "log";
|
|
133
|
-
const prefix = `[Sandbox:${msg.pluginId}]`;
|
|
134
|
-
console[level]?.(prefix, ...msg.payload?.args || []);
|
|
135
|
-
}
|
|
136
|
-
break;
|
|
137
|
-
case "SANDBOX_ERROR":
|
|
138
|
-
console.error(`[Sandbox:${msg.pluginId}] Error:`, msg.error);
|
|
139
|
-
if (this.onError) this.onError(msg.error || "Unknown error");
|
|
140
|
-
break;
|
|
141
|
-
default:
|
|
142
|
-
console.warn(`[Sandbox:${msg.pluginId}] Unknown message type: ${msg.type}`);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
async handleRpcFromPlugin(msg) {
|
|
146
|
-
if (!msg.requestId || !this.onRpcRequest) {
|
|
147
|
-
this.sendToWorker({
|
|
148
|
-
type: "SANDBOX_RPC_RESPONSE",
|
|
149
|
-
pluginId: msg.pluginId,
|
|
150
|
-
requestId: msg.requestId,
|
|
151
|
-
error: "No RPC handler available"
|
|
152
|
-
});
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
try {
|
|
156
|
-
const result = await this.onRpcRequest(msg.payload?.action, msg.payload?.data);
|
|
157
|
-
this.sendToWorker({
|
|
158
|
-
type: "SANDBOX_RPC_RESPONSE",
|
|
159
|
-
pluginId: msg.pluginId,
|
|
160
|
-
requestId: msg.requestId,
|
|
161
|
-
payload: result
|
|
162
|
-
});
|
|
163
|
-
} catch (error) {
|
|
164
|
-
this.sendToWorker({
|
|
165
|
-
type: "SANDBOX_RPC_RESPONSE",
|
|
166
|
-
pluginId: msg.pluginId,
|
|
167
|
-
requestId: msg.requestId,
|
|
168
|
-
error: error.message
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
handleRpcResponse(msg) {
|
|
173
|
-
const requestId = msg.requestId;
|
|
174
|
-
if (!requestId) return;
|
|
175
|
-
const pending = this.pendingRequests.get(requestId);
|
|
176
|
-
if (!pending) return;
|
|
177
|
-
clearTimeout(pending.timer);
|
|
178
|
-
this.pendingRequests.delete(requestId);
|
|
179
|
-
if (msg.error) {
|
|
180
|
-
pending.reject(new Error(msg.error));
|
|
181
|
-
} else {
|
|
182
|
-
pending.resolve(msg.payload);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
export {
|
|
187
|
-
PluginSandbox
|
|
188
|
-
};
|