@dxos/plugin-debug 0.7.5-labs.a279d8c → 0.7.5-labs.a8b535d
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/lib/browser/{DebugSpace-4JHYA7FG.mjs → DebugSpace-BTMTVZ6C.mjs} +2 -2
- package/dist/lib/browser/SpaceGenerator-BPZGOSH4.mjs +1238 -0
- package/dist/lib/browser/SpaceGenerator-BPZGOSH4.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-BZFZ6UG6.mjs +533 -0
- package/dist/lib/browser/app-graph-builder-BZFZ6UG6.mjs.map +7 -0
- package/dist/lib/browser/chunk-EF3UVAVI.mjs +21 -0
- package/dist/lib/browser/chunk-EF3UVAVI.mjs.map +7 -0
- package/dist/lib/browser/chunk-UASI2CRI.mjs +72 -0
- package/dist/lib/browser/chunk-UASI2CRI.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +40 -10
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-TCD3MNIT.mjs +16 -0
- package/dist/lib/browser/react-context-TCD3MNIT.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-ACHNR2UU.mjs → react-surface-W6QLG4YJ.mjs} +240 -80
- package/dist/lib/browser/react-surface-W6QLG4YJ.mjs.map +7 -0
- package/dist/lib/browser/{settings-JCZUA643.mjs → settings-INPXR64L.mjs} +6 -7
- package/dist/lib/browser/{settings-JCZUA643.mjs.map → settings-INPXR64L.mjs.map} +3 -3
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +110 -110
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +116 -116
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/components/Container.d.ts +2 -2
- package/dist/types/src/components/Container.d.ts.map +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts +1 -2
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts +1 -2
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/DebugSpace/ObjectCreator.d.ts +1 -2
- package/dist/types/src/components/DebugSpace/ObjectCreator.d.ts.map +1 -1
- package/dist/types/src/components/DebugStatus.d.ts +1 -2
- package/dist/types/src/components/DebugStatus.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts +1 -2
- package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +1 -2
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +22 -0
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -0
- package/dist/types/src/components/Wireframe.d.ts +1 -2
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +28 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +44 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +49 -46
- package/src/DebugPlugin.tsx +6 -3
- package/src/capabilities/app-graph-builder.ts +297 -89
- package/src/capabilities/react-context.tsx +3 -25
- package/src/capabilities/react-surface.tsx +202 -33
- package/src/capabilities/settings.ts +0 -1
- package/src/components/DebugSettings.tsx +7 -12
- package/src/components/DebugStatus.tsx +17 -21
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +2 -83
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +74 -7
- package/src/components/SpaceGenerator/presets.ts +563 -0
- package/src/meta.ts +3 -1
- package/src/translations.ts +28 -0
- package/src/types.ts +52 -1
- package/dist/lib/browser/SpaceGenerator-YNT3WDFI.mjs +0 -479
- package/dist/lib/browser/SpaceGenerator-YNT3WDFI.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-FXELWOFS.mjs +0 -177
- package/dist/lib/browser/app-graph-builder-FXELWOFS.mjs.map +0 -7
- package/dist/lib/browser/chunk-I3ON45JK.mjs +0 -18
- package/dist/lib/browser/chunk-I3ON45JK.mjs.map +0 -7
- package/dist/lib/browser/chunk-P7GHHMDB.mjs +0 -21
- package/dist/lib/browser/chunk-P7GHHMDB.mjs.map +0 -7
- package/dist/lib/browser/react-context-OZU6J7G3.mjs +0 -37
- package/dist/lib/browser/react-context-OZU6J7G3.mjs.map +0 -7
- package/dist/lib/browser/react-surface-ACHNR2UU.mjs.map +0 -7
- /package/dist/lib/browser/{DebugSpace-4JHYA7FG.mjs.map → DebugSpace-BTMTVZ6C.mjs.map} +0 -0
|
@@ -2,37 +2,15 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React
|
|
5
|
+
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, contributes } from '@dxos/app-framework';
|
|
8
|
-
import {
|
|
8
|
+
import { DevtoolsContextProvider } from '@dxos/devtools';
|
|
9
9
|
|
|
10
10
|
import { DEBUG_PLUGIN } from '../meta';
|
|
11
|
-
import { DebugContext } from '../types';
|
|
12
11
|
|
|
13
12
|
export default () =>
|
|
14
13
|
contributes(Capabilities.ReactContext, {
|
|
15
14
|
id: DEBUG_PLUGIN,
|
|
16
|
-
context: ({ children }) => {
|
|
17
|
-
const [timer, setTimer] = useState<Timer>();
|
|
18
|
-
useEffect(() => timer?.state.on((value) => !value && setTimer(undefined)), [timer]);
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
timer?.stop();
|
|
21
|
-
}, []);
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<DebugContext.Provider
|
|
25
|
-
value={{
|
|
26
|
-
running: !!timer,
|
|
27
|
-
start: (cb, options) => {
|
|
28
|
-
timer?.stop();
|
|
29
|
-
setTimer(new Timer(cb).start(options));
|
|
30
|
-
},
|
|
31
|
-
stop: () => timer?.stop(),
|
|
32
|
-
}}
|
|
33
|
-
>
|
|
34
|
-
{children}
|
|
35
|
-
</DebugContext.Provider>
|
|
36
|
-
);
|
|
37
|
-
},
|
|
15
|
+
context: ({ children }) => <DevtoolsContextProvider>{children}</DevtoolsContextProvider>,
|
|
38
16
|
});
|
|
@@ -9,10 +9,35 @@ import {
|
|
|
9
9
|
contributes,
|
|
10
10
|
createIntent,
|
|
11
11
|
createSurface,
|
|
12
|
-
|
|
12
|
+
LayoutAction,
|
|
13
13
|
type PluginsContext,
|
|
14
14
|
} from '@dxos/app-framework';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
ConfigPanel,
|
|
17
|
+
CredentialsPanel,
|
|
18
|
+
DeviceListPanel,
|
|
19
|
+
DiagnosticsPanel,
|
|
20
|
+
FeedsPanel,
|
|
21
|
+
IdentityPanel,
|
|
22
|
+
KeyringPanel,
|
|
23
|
+
LoggingPanel,
|
|
24
|
+
MembersPanel,
|
|
25
|
+
MetadataPanel,
|
|
26
|
+
NetworkPanel,
|
|
27
|
+
ObjectsPanel,
|
|
28
|
+
SignalPanel,
|
|
29
|
+
SpaceInfoPanel,
|
|
30
|
+
SpaceListPanel,
|
|
31
|
+
StoragePanel,
|
|
32
|
+
SwarmPanel,
|
|
33
|
+
TracingPanel,
|
|
34
|
+
DashboardPanel,
|
|
35
|
+
EdgeDashboardPanel,
|
|
36
|
+
SearchPanel,
|
|
37
|
+
AutomergePanel,
|
|
38
|
+
WorkflowPanel,
|
|
39
|
+
} from '@dxos/devtools';
|
|
40
|
+
import { SettingsStore } from '@dxos/local-storage';
|
|
16
41
|
import { Graph } from '@dxos/plugin-graph';
|
|
17
42
|
import { SpaceAction, CollectionType } from '@dxos/plugin-space/types';
|
|
18
43
|
import {
|
|
@@ -34,7 +59,7 @@ import {
|
|
|
34
59
|
Wireframe,
|
|
35
60
|
} from '../components';
|
|
36
61
|
import { DEBUG_PLUGIN } from '../meta';
|
|
37
|
-
import { type DebugSettingsProps } from '../types';
|
|
62
|
+
import { type DebugSettingsProps, Devtools } from '../types';
|
|
38
63
|
|
|
39
64
|
type SpaceDebug = {
|
|
40
65
|
type: string;
|
|
@@ -45,41 +70,17 @@ type GraphDebug = {
|
|
|
45
70
|
graph: Graph;
|
|
46
71
|
};
|
|
47
72
|
|
|
48
|
-
const isSpaceDebug = (data: any): data is SpaceDebug => data
|
|
49
|
-
const isGraphDebug = (data: any): data is GraphDebug => data
|
|
73
|
+
const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${DEBUG_PLUGIN}/space` && isSpace(data.space);
|
|
74
|
+
const isGraphDebug = (data: any): data is GraphDebug => data?.graph instanceof Graph;
|
|
50
75
|
|
|
51
76
|
export default (context: PluginsContext) =>
|
|
52
77
|
contributes(Capabilities.ReactSurface, [
|
|
53
78
|
createSurface({
|
|
54
79
|
id: `${DEBUG_PLUGIN}/settings`,
|
|
55
|
-
role: 'settings',
|
|
56
|
-
filter: (data): data is any => data.subject === DEBUG_PLUGIN,
|
|
57
|
-
component: () => {
|
|
58
|
-
const settings = useCapability(Capabilities.SettingsStore).getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;
|
|
59
|
-
return <DebugSettings settings={settings} />;
|
|
60
|
-
},
|
|
61
|
-
}),
|
|
62
|
-
createSurface({
|
|
63
|
-
id: `${DEBUG_PLUGIN}/status`,
|
|
64
|
-
role: 'status',
|
|
65
|
-
component: () => <DebugStatus />,
|
|
66
|
-
}),
|
|
67
|
-
createSurface({
|
|
68
|
-
id: `${DEBUG_PLUGIN}/complementary`,
|
|
69
|
-
role: 'complementary--debug',
|
|
70
|
-
filter: (data): data is { subject: ReactiveEchoObject<any> } => isEchoObject(data.subject),
|
|
71
|
-
component: ({ data }) => <DebugObjectPanel object={data.subject} />,
|
|
72
|
-
}),
|
|
73
|
-
createSurface({
|
|
74
|
-
id: `${DEBUG_PLUGIN}/devtools`,
|
|
75
80
|
role: 'article',
|
|
76
|
-
filter: (data): data is
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
.getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;
|
|
80
|
-
return data.subject === 'devtools' && !!settings.devtools;
|
|
81
|
-
},
|
|
82
|
-
component: () => <Devtools />,
|
|
81
|
+
filter: (data): data is { subject: SettingsStore<DebugSettingsProps> } =>
|
|
82
|
+
data.subject instanceof SettingsStore && data.subject.prefix === DEBUG_PLUGIN,
|
|
83
|
+
component: ({ data: { subject } }) => <DebugSettings settings={subject.value} />,
|
|
83
84
|
}),
|
|
84
85
|
createSurface({
|
|
85
86
|
id: `${DEBUG_PLUGIN}/space`,
|
|
@@ -124,7 +125,7 @@ export default (context: PluginsContext) =>
|
|
|
124
125
|
createSurface({
|
|
125
126
|
id: `${DEBUG_PLUGIN}/wireframe`,
|
|
126
127
|
role: ['article', 'section'],
|
|
127
|
-
|
|
128
|
+
position: 'hoist',
|
|
128
129
|
filter: (data): data is { subject: ReactiveEchoObject<any> } => {
|
|
129
130
|
const settings = context
|
|
130
131
|
.requestCapability(Capabilities.SettingsStore)
|
|
@@ -135,4 +136,172 @@ export default (context: PluginsContext) =>
|
|
|
135
136
|
<Wireframe label={`${role}:${name}`} object={data.subject} classNames='row-span-2 overflow-hidden' />
|
|
136
137
|
),
|
|
137
138
|
}),
|
|
139
|
+
createSurface({
|
|
140
|
+
id: `${DEBUG_PLUGIN}/complementary`,
|
|
141
|
+
role: 'complementary--debug',
|
|
142
|
+
filter: (data): data is { subject: ReactiveEchoObject<any> } => isEchoObject(data.subject),
|
|
143
|
+
component: ({ data }) => <DebugObjectPanel object={data.subject} />,
|
|
144
|
+
}),
|
|
145
|
+
createSurface({
|
|
146
|
+
id: `${DEBUG_PLUGIN}/status`,
|
|
147
|
+
role: 'status',
|
|
148
|
+
component: () => <DebugStatus />,
|
|
149
|
+
}),
|
|
150
|
+
|
|
151
|
+
//
|
|
152
|
+
// Devtools
|
|
153
|
+
//
|
|
154
|
+
|
|
155
|
+
createSurface({
|
|
156
|
+
id: `${DEBUG_PLUGIN}/client/config`,
|
|
157
|
+
role: 'article',
|
|
158
|
+
filter: (data): data is any => data.subject === Devtools.Client.Config,
|
|
159
|
+
component: () => <ConfigPanel />,
|
|
160
|
+
}),
|
|
161
|
+
createSurface({
|
|
162
|
+
id: `${DEBUG_PLUGIN}/client/storage`,
|
|
163
|
+
role: 'article',
|
|
164
|
+
filter: (data): data is any => data.subject === Devtools.Client.Storage,
|
|
165
|
+
component: () => <StoragePanel />,
|
|
166
|
+
}),
|
|
167
|
+
createSurface({
|
|
168
|
+
id: `${DEBUG_PLUGIN}/client/logs`,
|
|
169
|
+
role: 'article',
|
|
170
|
+
filter: (data): data is any => data.subject === Devtools.Client.Logs,
|
|
171
|
+
component: () => <LoggingPanel />,
|
|
172
|
+
}),
|
|
173
|
+
createSurface({
|
|
174
|
+
id: `${DEBUG_PLUGIN}/client/diagnostics`,
|
|
175
|
+
role: 'article',
|
|
176
|
+
filter: (data): data is any => data.subject === Devtools.Client.Diagnostics,
|
|
177
|
+
component: () => <DiagnosticsPanel />,
|
|
178
|
+
}),
|
|
179
|
+
createSurface({
|
|
180
|
+
id: `${DEBUG_PLUGIN}/client/tracing`,
|
|
181
|
+
role: 'article',
|
|
182
|
+
filter: (data): data is any => data.subject === Devtools.Client.Tracing,
|
|
183
|
+
component: () => <TracingPanel />,
|
|
184
|
+
}),
|
|
185
|
+
createSurface({
|
|
186
|
+
id: `${DEBUG_PLUGIN}/halo/identity`,
|
|
187
|
+
role: 'article',
|
|
188
|
+
filter: (data): data is any => data.subject === Devtools.Halo.Identity,
|
|
189
|
+
component: () => <IdentityPanel />,
|
|
190
|
+
}),
|
|
191
|
+
createSurface({
|
|
192
|
+
id: `${DEBUG_PLUGIN}/halo/devices`,
|
|
193
|
+
role: 'article',
|
|
194
|
+
filter: (data): data is any => data.subject === Devtools.Halo.Devices,
|
|
195
|
+
component: () => <DeviceListPanel />,
|
|
196
|
+
}),
|
|
197
|
+
createSurface({
|
|
198
|
+
id: `${DEBUG_PLUGIN}/halo/keyring`,
|
|
199
|
+
role: 'article',
|
|
200
|
+
filter: (data): data is any => data.subject === Devtools.Halo.Keyring,
|
|
201
|
+
component: () => <KeyringPanel />,
|
|
202
|
+
}),
|
|
203
|
+
createSurface({
|
|
204
|
+
id: `${DEBUG_PLUGIN}/halo/credentials`,
|
|
205
|
+
role: 'article',
|
|
206
|
+
filter: (data): data is any => data.subject === Devtools.Halo.Credentials,
|
|
207
|
+
component: () => <CredentialsPanel />,
|
|
208
|
+
}),
|
|
209
|
+
createSurface({
|
|
210
|
+
id: `${DEBUG_PLUGIN}/echo/spaces`,
|
|
211
|
+
role: 'article',
|
|
212
|
+
filter: (data): data is any => data.subject === Devtools.Echo.Spaces,
|
|
213
|
+
component: () => {
|
|
214
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
215
|
+
const handleSelect = useCallback(
|
|
216
|
+
() => dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [Devtools.Echo.Space] })),
|
|
217
|
+
[dispatch],
|
|
218
|
+
);
|
|
219
|
+
return <SpaceListPanel onSelect={handleSelect} />;
|
|
220
|
+
},
|
|
221
|
+
}),
|
|
222
|
+
createSurface({
|
|
223
|
+
id: `${DEBUG_PLUGIN}/echo/space`,
|
|
224
|
+
role: 'article',
|
|
225
|
+
filter: (data): data is any => data.subject === Devtools.Echo.Space,
|
|
226
|
+
component: () => {
|
|
227
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
228
|
+
const handleSelect = useCallback(
|
|
229
|
+
() => dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [Devtools.Echo.Feeds] })),
|
|
230
|
+
[dispatch],
|
|
231
|
+
);
|
|
232
|
+
return <SpaceInfoPanel onSelectFeed={handleSelect} onSelectPipeline={handleSelect} />;
|
|
233
|
+
},
|
|
234
|
+
}),
|
|
235
|
+
createSurface({
|
|
236
|
+
id: `${DEBUG_PLUGIN}/echo/feeds`,
|
|
237
|
+
role: 'article',
|
|
238
|
+
filter: (data): data is any => data.subject === Devtools.Echo.Feeds,
|
|
239
|
+
component: () => <FeedsPanel />,
|
|
240
|
+
}),
|
|
241
|
+
createSurface({
|
|
242
|
+
id: `${DEBUG_PLUGIN}/echo/objects`,
|
|
243
|
+
role: 'article',
|
|
244
|
+
filter: (data): data is any => data.subject === Devtools.Echo.Objects,
|
|
245
|
+
component: () => <ObjectsPanel />,
|
|
246
|
+
}),
|
|
247
|
+
createSurface({
|
|
248
|
+
id: `${DEBUG_PLUGIN}/echo/automerge`,
|
|
249
|
+
role: 'article',
|
|
250
|
+
filter: (data): data is any => data.subject === Devtools.Echo.Automerge,
|
|
251
|
+
component: () => <AutomergePanel />,
|
|
252
|
+
}),
|
|
253
|
+
createSurface({
|
|
254
|
+
id: `${DEBUG_PLUGIN}/echo/members`,
|
|
255
|
+
role: 'article',
|
|
256
|
+
filter: (data): data is any => data.subject === Devtools.Echo.Members,
|
|
257
|
+
component: () => <MembersPanel />,
|
|
258
|
+
}),
|
|
259
|
+
createSurface({
|
|
260
|
+
id: `${DEBUG_PLUGIN}/echo/metadata`,
|
|
261
|
+
role: 'article',
|
|
262
|
+
filter: (data): data is any => data.subject === Devtools.Echo.Metadata,
|
|
263
|
+
component: () => <MetadataPanel />,
|
|
264
|
+
}),
|
|
265
|
+
createSurface({
|
|
266
|
+
id: `${DEBUG_PLUGIN}/mesh/signal`,
|
|
267
|
+
role: 'article',
|
|
268
|
+
filter: (data): data is any => data.subject === Devtools.Mesh.Signal,
|
|
269
|
+
component: () => <SignalPanel />,
|
|
270
|
+
}),
|
|
271
|
+
createSurface({
|
|
272
|
+
id: `${DEBUG_PLUGIN}/mesh/swarm`,
|
|
273
|
+
role: 'article',
|
|
274
|
+
filter: (data): data is any => data.subject === Devtools.Mesh.Swarm,
|
|
275
|
+
component: () => <SwarmPanel />,
|
|
276
|
+
}),
|
|
277
|
+
createSurface({
|
|
278
|
+
id: `${DEBUG_PLUGIN}/mesh/network`,
|
|
279
|
+
role: 'article',
|
|
280
|
+
filter: (data): data is any => data.subject === Devtools.Mesh.Network,
|
|
281
|
+
component: () => <NetworkPanel />,
|
|
282
|
+
}),
|
|
283
|
+
createSurface({
|
|
284
|
+
id: `${DEBUG_PLUGIN}/agent/dashboard`,
|
|
285
|
+
role: 'article',
|
|
286
|
+
filter: (data): data is any => data.subject === Devtools.Agent.Dashboard,
|
|
287
|
+
component: () => <DashboardPanel />,
|
|
288
|
+
}),
|
|
289
|
+
createSurface({
|
|
290
|
+
id: `${DEBUG_PLUGIN}/agent/search`,
|
|
291
|
+
role: 'article',
|
|
292
|
+
filter: (data): data is any => data.subject === Devtools.Agent.Search,
|
|
293
|
+
component: () => <SearchPanel />,
|
|
294
|
+
}),
|
|
295
|
+
createSurface({
|
|
296
|
+
id: `${DEBUG_PLUGIN}/edge/dashboard`,
|
|
297
|
+
role: 'article',
|
|
298
|
+
filter: (data): data is any => data.subject === Devtools.Edge.Dashboard,
|
|
299
|
+
component: () => <EdgeDashboardPanel />,
|
|
300
|
+
}),
|
|
301
|
+
createSurface({
|
|
302
|
+
id: `${DEBUG_PLUGIN}/edge/workflows`,
|
|
303
|
+
role: 'article',
|
|
304
|
+
filter: (data): data is any => data.subject === Devtools.Edge.Workflows,
|
|
305
|
+
component: () => <WorkflowPanel />,
|
|
306
|
+
}),
|
|
138
307
|
]);
|
|
@@ -11,7 +11,6 @@ import { type DebugSettingsProps, DebugSettingsSchema } from '../types';
|
|
|
11
11
|
export default () => {
|
|
12
12
|
const settings = create<DebugSettingsProps>({
|
|
13
13
|
debug: true,
|
|
14
|
-
devtools: true,
|
|
15
14
|
});
|
|
16
15
|
|
|
17
16
|
return contributes(Capabilities.Settings, { schema: DebugSettingsSchema, prefix: DEBUG_PLUGIN, value: settings });
|
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Gift, DownloadSimple, FirstAidKit } from '@phosphor-icons/react';
|
|
6
5
|
import React, { useEffect, useState } from 'react';
|
|
7
6
|
|
|
8
7
|
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
9
8
|
import { type ConfigProto, defs, SaveConfig, Storage } from '@dxos/config';
|
|
10
9
|
import { log } from '@dxos/log';
|
|
11
10
|
import { useClient } from '@dxos/react-client';
|
|
12
|
-
import { useTranslation, Button, Toast, Input, useFileDownload, Select } from '@dxos/react-ui';
|
|
13
|
-
import { DeprecatedFormInput } from '@dxos/react-ui-form';
|
|
14
|
-
import { getSize, mx } from '@dxos/react-ui-theme';
|
|
11
|
+
import { useTranslation, Button, Toast, Input, useFileDownload, Select, Icon } from '@dxos/react-ui';
|
|
12
|
+
import { DeprecatedFormContainer, DeprecatedFormInput } from '@dxos/react-ui-form';
|
|
15
13
|
import { setDeep } from '@dxos/util';
|
|
16
14
|
|
|
17
15
|
import { DEBUG_PLUGIN } from '../meta';
|
|
@@ -79,24 +77,21 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
79
77
|
};
|
|
80
78
|
|
|
81
79
|
return (
|
|
82
|
-
|
|
80
|
+
<DeprecatedFormContainer>
|
|
83
81
|
<DeprecatedFormInput label={t('settings show debug panel')}>
|
|
84
82
|
<Input.Switch checked={settings.debug} onCheckedChange={(checked) => (settings.debug = !!checked)} />
|
|
85
83
|
</DeprecatedFormInput>
|
|
86
|
-
<DeprecatedFormInput label={t('settings show devtools panel')}>
|
|
87
|
-
<Input.Switch checked={settings.devtools} onCheckedChange={(checked) => (settings.devtools = !!checked)} />
|
|
88
|
-
</DeprecatedFormInput>
|
|
89
84
|
<DeprecatedFormInput label={t('settings wireframe')}>
|
|
90
85
|
<Input.Switch checked={settings.wireframe} onCheckedChange={(checked) => (settings.wireframe = !!checked)} />
|
|
91
86
|
</DeprecatedFormInput>
|
|
92
87
|
<DeprecatedFormInput label={t('settings download diagnostics')}>
|
|
93
88
|
<Button onClick={handleDownload}>
|
|
94
|
-
<
|
|
89
|
+
<Icon icon='ph--download-simple--regular' size={5} />
|
|
95
90
|
</Button>
|
|
96
91
|
</DeprecatedFormInput>
|
|
97
92
|
<DeprecatedFormInput label={t('settings repair')}>
|
|
98
93
|
<Button onClick={handleRepair}>
|
|
99
|
-
<
|
|
94
|
+
<Icon icon='ph--first-aid-kit--regular' size={5} />
|
|
100
95
|
</Button>
|
|
101
96
|
</DeprecatedFormInput>
|
|
102
97
|
|
|
@@ -105,7 +100,7 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
105
100
|
<Toast.Root>
|
|
106
101
|
<Toast.Body>
|
|
107
102
|
<Toast.Title>
|
|
108
|
-
<
|
|
103
|
+
<Icon icon='ph--gift--duotone' size={5} classNames='inline mr-1' />
|
|
109
104
|
<span>{toast.title}</span>
|
|
110
105
|
</Toast.Title>
|
|
111
106
|
{toast.description && <Toast.Description>{toast.description}</Toast.Description>}
|
|
@@ -145,7 +140,7 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
145
140
|
</Select.Portal>
|
|
146
141
|
</Select.Root>
|
|
147
142
|
</DeprecatedFormInput>
|
|
148
|
-
|
|
143
|
+
</DeprecatedFormContainer>
|
|
149
144
|
);
|
|
150
145
|
};
|
|
151
146
|
|
|
@@ -4,15 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useEffect, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { useAppGraph, useLayout } from '@dxos/app-framework';
|
|
8
8
|
import { TimeoutError } from '@dxos/async';
|
|
9
9
|
import { StatsPanel, useStats } from '@dxos/devtools';
|
|
10
10
|
import { getActiveSpace } from '@dxos/plugin-space';
|
|
11
11
|
import { StatusBar } from '@dxos/plugin-status-bar';
|
|
12
12
|
import { ConnectionState } from '@dxos/protocols/proto/dxos/client/services';
|
|
13
13
|
import { useNetworkStatus } from '@dxos/react-client/mesh';
|
|
14
|
-
import { Icon } from '@dxos/react-ui';
|
|
15
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
14
|
+
import { Icon, Popover } from '@dxos/react-ui';
|
|
16
15
|
|
|
17
16
|
const styles = {
|
|
18
17
|
success: 'text-sky-300 dark:text-green-700',
|
|
@@ -136,9 +135,9 @@ const SwarmIndicator = () => {
|
|
|
136
135
|
// TODO(burdon): Merge with SaveStatus.
|
|
137
136
|
const SavingIndicator = () => {
|
|
138
137
|
const [state, _setState] = useState(0);
|
|
139
|
-
const
|
|
140
|
-
const { graph } =
|
|
141
|
-
const _space =
|
|
138
|
+
const layout = useLayout();
|
|
139
|
+
const { graph } = useAppGraph();
|
|
140
|
+
const _space = graph ? getActiveSpace(graph, layout.active[0]) : undefined;
|
|
142
141
|
// TODO(dmaretskyi): Fix this when we have save status for automerge.
|
|
143
142
|
// useEffect(() => {
|
|
144
143
|
// if (!space) {
|
|
@@ -186,22 +185,19 @@ const PerformanceIndicator = () => {
|
|
|
186
185
|
const [stats, refreshStats] = useStats();
|
|
187
186
|
|
|
188
187
|
return (
|
|
189
|
-
|
|
190
|
-
<
|
|
191
|
-
<
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
'overflow-x-hidden overflow-y-auto scrollbar-thin',
|
|
198
|
-
'border-x border-y border-separator',
|
|
199
|
-
)}
|
|
200
|
-
>
|
|
188
|
+
<Popover.Root open={visible} onOpenChange={setVisible}>
|
|
189
|
+
<Popover.Trigger asChild>
|
|
190
|
+
<StatusBar.Button onClick={() => setVisible((visible) => !visible)} title='Performance panels'>
|
|
191
|
+
<Icon icon='ph--chart-bar--regular' size={4} />
|
|
192
|
+
</StatusBar.Button>
|
|
193
|
+
</Popover.Trigger>
|
|
194
|
+
<Popover.Portal>
|
|
195
|
+
<Popover.Content classNames='max-is-[min(var(--radix-popover-content-available-width),300px)] max-bs-[--radix-popover-content-available-height]'>
|
|
201
196
|
<StatsPanel stats={stats} onRefresh={refreshStats} />
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
197
|
+
<Popover.Arrow />
|
|
198
|
+
</Popover.Content>
|
|
199
|
+
</Popover.Portal>
|
|
200
|
+
</Popover.Root>
|
|
205
201
|
);
|
|
206
202
|
};
|
|
207
203
|
|
|
@@ -5,9 +5,7 @@
|
|
|
5
5
|
import { addressToA1Notation } from '@dxos/compute';
|
|
6
6
|
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from '@dxos/conductor';
|
|
7
7
|
import { ObjectId, type BaseObject, type TypedObject } from '@dxos/echo-schema';
|
|
8
|
-
import {
|
|
9
|
-
import { invariant } from '@dxos/invariant';
|
|
10
|
-
import { DXN, SpaceId } from '@dxos/keys';
|
|
8
|
+
import { DXN } from '@dxos/keys';
|
|
11
9
|
import { create, makeRef, type ReactiveObject } from '@dxos/live-object';
|
|
12
10
|
import { DocumentType } from '@dxos/plugin-markdown/types';
|
|
13
11
|
import { createSheet } from '@dxos/plugin-sheet/types';
|
|
@@ -15,23 +13,6 @@ import { SheetType, type CellValue } from '@dxos/plugin-sheet/types';
|
|
|
15
13
|
import { CanvasType, DiagramType } from '@dxos/plugin-sketch/types';
|
|
16
14
|
import { faker } from '@dxos/random';
|
|
17
15
|
import { Filter, type Space } from '@dxos/react-client/echo';
|
|
18
|
-
import {
|
|
19
|
-
type ComputeShape,
|
|
20
|
-
createAppend,
|
|
21
|
-
createComputeGraph,
|
|
22
|
-
createConstant,
|
|
23
|
-
createGpt,
|
|
24
|
-
createQueue,
|
|
25
|
-
createText,
|
|
26
|
-
createTrigger,
|
|
27
|
-
} from '@dxos/react-ui-canvas-compute';
|
|
28
|
-
import {
|
|
29
|
-
pointMultiply,
|
|
30
|
-
pointsToRect,
|
|
31
|
-
rectToPoints,
|
|
32
|
-
CanvasBoardType,
|
|
33
|
-
CanvasGraphModel,
|
|
34
|
-
} from '@dxos/react-ui-canvas-editor';
|
|
35
16
|
import { TableType } from '@dxos/react-ui-table';
|
|
36
17
|
import { createView, TextType } from '@dxos/schema';
|
|
37
18
|
import { createAsyncGenerator, type ValueGenerator } from '@dxos/schema/testing';
|
|
@@ -139,7 +120,7 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
139
120
|
.createNode({
|
|
140
121
|
id: 'gpt-QUEUE_ID',
|
|
141
122
|
type: 'constant',
|
|
142
|
-
value: new DXN(DXN.kind.QUEUE, ['data',
|
|
123
|
+
value: new DXN(DXN.kind.QUEUE, ['data', space.id, ObjectId.random()]).toString(),
|
|
143
124
|
})
|
|
144
125
|
.createNode({ id: 'gpt-APPEND', type: 'append' })
|
|
145
126
|
.createNode({ id: 'gpt-OUTPUT', type: NODE_OUTPUT })
|
|
@@ -155,70 +136,8 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
155
136
|
return objects;
|
|
156
137
|
},
|
|
157
138
|
],
|
|
158
|
-
[
|
|
159
|
-
CanvasBoardType.typename,
|
|
160
|
-
async (space, n, cb) => {
|
|
161
|
-
const objects = range(n, () => {
|
|
162
|
-
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
163
|
-
|
|
164
|
-
let functionTrigger: FunctionTrigger | undefined;
|
|
165
|
-
canvasModel.builder.call((builder) => {
|
|
166
|
-
const gpt = canvasModel.createNode(createGpt(position({ x: 0, y: -14 })));
|
|
167
|
-
const triggerShape = createTrigger({ triggerKind: TriggerKind.Webhook, ...position({ x: -18, y: -2 }) });
|
|
168
|
-
const trigger = canvasModel.createNode(triggerShape);
|
|
169
|
-
const text = canvasModel.createNode(createText(position({ x: 19, y: 3, width: 10, height: 10 })));
|
|
170
|
-
const queueId = canvasModel.createNode(
|
|
171
|
-
createConstant({
|
|
172
|
-
value: new DXN(DXN.kind.QUEUE, ['data', SpaceId.random(), ObjectId.random()]).toString(),
|
|
173
|
-
...position({ x: -18, y: 5, width: 8, height: 6 }),
|
|
174
|
-
}),
|
|
175
|
-
);
|
|
176
|
-
const queue = canvasModel.createNode(createQueue(position({ x: -3, y: 3, width: 14, height: 10 })));
|
|
177
|
-
const append = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
|
|
178
|
-
|
|
179
|
-
builder
|
|
180
|
-
.createEdge({ source: trigger.id, target: gpt.id, input: 'prompt', output: 'bodyText' })
|
|
181
|
-
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
182
|
-
.createEdge({ source: queueId.id, target: queue.id })
|
|
183
|
-
.createEdge({ source: queueId.id, target: append.id, input: 'id' })
|
|
184
|
-
.createEdge({ source: gpt.id, target: append.id, output: 'messages', input: 'items' });
|
|
185
|
-
|
|
186
|
-
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
const computeModel = createComputeGraph(canvasModel);
|
|
190
|
-
const computeGraph = computeModel.root;
|
|
191
|
-
|
|
192
|
-
invariant(functionTrigger);
|
|
193
|
-
functionTrigger.function = DXN.fromLocalObjectId(computeGraph.id).toString();
|
|
194
|
-
functionTrigger.meta ??= {};
|
|
195
|
-
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
|
|
196
|
-
functionTrigger.meta.computeNodeId = inputNode.id;
|
|
197
|
-
|
|
198
|
-
return space.db.add(
|
|
199
|
-
create(CanvasBoardType, {
|
|
200
|
-
computeGraph: makeRef(computeGraph),
|
|
201
|
-
layout: canvasModel.graph,
|
|
202
|
-
}),
|
|
203
|
-
);
|
|
204
|
-
});
|
|
205
|
-
cb?.(objects);
|
|
206
|
-
return objects;
|
|
207
|
-
},
|
|
208
|
-
],
|
|
209
139
|
]);
|
|
210
140
|
|
|
211
|
-
const position = (rect: { x: number; y: number; width?: number; height?: number }) => {
|
|
212
|
-
const snap = 32;
|
|
213
|
-
const [center, size] = rectToPoints({ width: 0, height: 0, ...rect });
|
|
214
|
-
const { x, y, width, height } = pointsToRect([pointMultiply(center, snap), pointMultiply(size, snap)]);
|
|
215
|
-
if (width && height) {
|
|
216
|
-
return { center: { x, y }, size: width && height ? { width, height } : undefined };
|
|
217
|
-
} else {
|
|
218
|
-
return { center: { x, y } };
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
|
|
222
141
|
export const createGenerator = <T extends BaseObject>(type: TypedObject<T>): ObjectGenerator<T> => {
|
|
223
142
|
return async (
|
|
224
143
|
space: Space,
|