@dxos/plugin-debug 0.7.5-main.9d26e3a → 0.7.5-main.b19bfc8
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/{DebugApp-HCHR6GKO.mjs → DebugApp-LQHFFK3Y.mjs} +4 -2
- package/dist/lib/browser/{DebugApp-HCHR6GKO.mjs.map → DebugApp-LQHFFK3Y.mjs.map} +3 -3
- package/dist/lib/browser/{DebugSpace-V3K3PQP6.mjs → DebugSpace-BTMTVZ6C.mjs} +7 -5
- package/dist/lib/browser/{DebugSpace-V3K3PQP6.mjs.map → DebugSpace-BTMTVZ6C.mjs.map} +3 -3
- 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 +97 -713
- package/dist/lib/browser/index.mjs.map +4 -4
- 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-W6QLG4YJ.mjs +641 -0
- package/dist/lib/browser/react-surface-W6QLG4YJ.mjs.map +7 -0
- package/dist/lib/browser/settings-INPXR64L.mjs +24 -0
- package/dist/lib/browser/settings-INPXR64L.mjs.map +7 -0
- package/dist/types/src/DebugPlugin.d.ts +1 -2
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +185 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-context.d.ts +8 -0
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +4 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- 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/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- 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 -4
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +51 -52
- package/src/DebugPlugin.tsx +61 -345
- package/src/capabilities/app-graph-builder.ts +385 -0
- package/src/capabilities/index.ts +10 -0
- package/src/capabilities/react-context.tsx +16 -0
- package/src/capabilities/react-surface.tsx +307 -0
- package/src/capabilities/settings.ts +17 -0
- package/src/components/DebugApp/DebugApp.tsx +1 -1
- package/src/components/DebugObjectPanel.tsx +17 -5
- package/src/components/DebugSettings.tsx +11 -16
- package/src/components/DebugSpace/DebugSpace.tsx +1 -1
- package/src/components/DebugStatus.tsx +17 -27
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +34 -7
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +76 -7
- package/src/components/SpaceGenerator/presets.ts +563 -0
- package/src/index.ts +1 -4
- package/src/meta.ts +4 -2
- package/src/translations.ts +28 -0
- package/src/types.ts +51 -13
- package/dist/lib/browser/SpaceGenerator-Y2NXBQVR.mjs +0 -277
- package/dist/lib/browser/SpaceGenerator-Y2NXBQVR.mjs.map +0 -7
- package/dist/lib/browser/chunk-6CGQHKET.mjs +0 -21
- package/dist/lib/browser/chunk-6CGQHKET.mjs.map +0 -7
- package/dist/lib/browser/chunk-CAENAAHY.mjs +0 -18
- package/dist/lib/browser/chunk-CAENAAHY.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -9
- package/dist/lib/browser/meta.mjs.map +0 -7
- package/dist/types/src/components/DebugSurface.d.ts +0 -9
- package/dist/types/src/components/DebugSurface.d.ts.map +0 -1
- package/src/components/DebugSurface.tsx +0 -55
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
Capabilities,
|
|
9
|
+
contributes,
|
|
10
|
+
createIntent,
|
|
11
|
+
createSurface,
|
|
12
|
+
LayoutAction,
|
|
13
|
+
type PluginsContext,
|
|
14
|
+
} from '@dxos/app-framework';
|
|
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';
|
|
41
|
+
import { Graph } from '@dxos/plugin-graph';
|
|
42
|
+
import { SpaceAction, CollectionType } from '@dxos/plugin-space/types';
|
|
43
|
+
import {
|
|
44
|
+
SpaceState,
|
|
45
|
+
isSpace,
|
|
46
|
+
isEchoObject,
|
|
47
|
+
type ReactiveEchoObject,
|
|
48
|
+
type ReactiveObject,
|
|
49
|
+
type Space,
|
|
50
|
+
} from '@dxos/react-client/echo';
|
|
51
|
+
|
|
52
|
+
import {
|
|
53
|
+
DebugApp,
|
|
54
|
+
DebugObjectPanel,
|
|
55
|
+
DebugSettings,
|
|
56
|
+
DebugSpace,
|
|
57
|
+
DebugStatus,
|
|
58
|
+
SpaceGenerator,
|
|
59
|
+
Wireframe,
|
|
60
|
+
} from '../components';
|
|
61
|
+
import { DEBUG_PLUGIN } from '../meta';
|
|
62
|
+
import { type DebugSettingsProps, Devtools } from '../types';
|
|
63
|
+
|
|
64
|
+
type SpaceDebug = {
|
|
65
|
+
type: string;
|
|
66
|
+
space: Space;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
type GraphDebug = {
|
|
70
|
+
graph: Graph;
|
|
71
|
+
};
|
|
72
|
+
|
|
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;
|
|
75
|
+
|
|
76
|
+
export default (context: PluginsContext) =>
|
|
77
|
+
contributes(Capabilities.ReactSurface, [
|
|
78
|
+
createSurface({
|
|
79
|
+
id: `${DEBUG_PLUGIN}/settings`,
|
|
80
|
+
role: 'article',
|
|
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} />,
|
|
84
|
+
}),
|
|
85
|
+
createSurface({
|
|
86
|
+
id: `${DEBUG_PLUGIN}/space`,
|
|
87
|
+
role: 'article',
|
|
88
|
+
filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),
|
|
89
|
+
component: ({ data }) => {
|
|
90
|
+
const handleCreateObject = useCallback(
|
|
91
|
+
(objects: ReactiveObject<any>[]) => {
|
|
92
|
+
if (!isSpace(data.subject.space)) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const collection =
|
|
97
|
+
data.subject.space.state.get() === SpaceState.SPACE_READY &&
|
|
98
|
+
data.subject.space.properties[CollectionType.typename]?.target;
|
|
99
|
+
if (!(collection instanceof CollectionType)) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
104
|
+
objects.forEach((object) => {
|
|
105
|
+
void dispatch(createIntent(SpaceAction.AddObject, { target: collection, object }));
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
[data.subject.space],
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const deprecated = false;
|
|
112
|
+
return deprecated ? (
|
|
113
|
+
<DebugSpace space={data.subject.space} onAddObjects={handleCreateObject} />
|
|
114
|
+
) : (
|
|
115
|
+
<SpaceGenerator space={data.subject.space} onCreateObjects={handleCreateObject} />
|
|
116
|
+
);
|
|
117
|
+
},
|
|
118
|
+
}),
|
|
119
|
+
createSurface({
|
|
120
|
+
id: `${DEBUG_PLUGIN}/graph`,
|
|
121
|
+
role: 'article',
|
|
122
|
+
filter: (data): data is { subject: GraphDebug } => isGraphDebug(data.subject),
|
|
123
|
+
component: ({ data }) => <DebugApp graph={data.subject.graph} />,
|
|
124
|
+
}),
|
|
125
|
+
createSurface({
|
|
126
|
+
id: `${DEBUG_PLUGIN}/wireframe`,
|
|
127
|
+
role: ['article', 'section'],
|
|
128
|
+
position: 'hoist',
|
|
129
|
+
filter: (data): data is { subject: ReactiveEchoObject<any> } => {
|
|
130
|
+
const settings = context
|
|
131
|
+
.requestCapability(Capabilities.SettingsStore)
|
|
132
|
+
.getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;
|
|
133
|
+
return isEchoObject(data.subject) && !!settings.wireframe;
|
|
134
|
+
},
|
|
135
|
+
component: ({ data, role }) => (
|
|
136
|
+
<Wireframe label={`${role}:${name}`} object={data.subject} classNames='row-span-2 overflow-hidden' />
|
|
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
|
+
}),
|
|
307
|
+
]);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capabilities, contributes } from '@dxos/app-framework';
|
|
6
|
+
import { create } from '@dxos/react-client/echo';
|
|
7
|
+
|
|
8
|
+
import { DEBUG_PLUGIN } from '../meta';
|
|
9
|
+
import { type DebugSettingsProps, DebugSettingsSchema } from '../types';
|
|
10
|
+
|
|
11
|
+
export default () => {
|
|
12
|
+
const settings = create<DebugSettingsProps>({
|
|
13
|
+
debug: true,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
return contributes(Capabilities.Settings, { schema: DebugSettingsSchema, prefix: DEBUG_PLUGIN, value: settings });
|
|
17
|
+
};
|
|
@@ -59,7 +59,7 @@ export const DebugApp: FC<{ graph: Graph }> = ({ graph }) => {
|
|
|
59
59
|
</ToggleGroupItem>
|
|
60
60
|
</ToggleGroup>
|
|
61
61
|
|
|
62
|
-
<Toolbar.
|
|
62
|
+
<Toolbar.Separator variant='gap' />
|
|
63
63
|
<Button onClick={(event) => handleResetClient(event.shiftKey)} title='Reset client'>
|
|
64
64
|
<Warning className={mx(getSize(5), 'text-red-700')} />
|
|
65
65
|
</Button>
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { type ReactiveEchoObject } from '@dxos/client/echo';
|
|
8
|
+
import { Clipboard, Input } from '@dxos/react-ui';
|
|
8
9
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
9
10
|
|
|
10
11
|
export type DebugObjectPanelProps = {
|
|
@@ -13,11 +14,22 @@ export type DebugObjectPanelProps = {
|
|
|
13
14
|
|
|
14
15
|
// TODO(burdon): Get schema and traverse references.
|
|
15
16
|
export const DebugObjectPanel = ({ object }: DebugObjectPanelProps) => {
|
|
17
|
+
const dxn = `dxn:echo:@:${object.id}`;
|
|
16
18
|
return (
|
|
17
|
-
<
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
<Clipboard.Provider>
|
|
20
|
+
<div className='flex flex-col'>
|
|
21
|
+
<Input.Root>
|
|
22
|
+
<div role='none' className='flex flex-col gap-1'>
|
|
23
|
+
<div role='none' className='flex gap-1'>
|
|
24
|
+
<Input.TextInput disabled value={dxn} />
|
|
25
|
+
<Clipboard.IconButton value={dxn} />
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</Input.Root>
|
|
29
|
+
<SyntaxHighlighter classNames='flex text-xs' language='json'>
|
|
30
|
+
{JSON.stringify(object, null, 2)}
|
|
31
|
+
</SyntaxHighlighter>
|
|
32
|
+
</div>
|
|
33
|
+
</Clipboard.Provider>
|
|
22
34
|
);
|
|
23
35
|
};
|
|
@@ -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
|
-
import {
|
|
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';
|
|
@@ -34,7 +32,7 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
34
32
|
const download = useFileDownload();
|
|
35
33
|
// TODO(mykola): Get updates from other places that change Config.
|
|
36
34
|
const [storageConfig, setStorageConfig] = useState<ConfigProto>({});
|
|
37
|
-
const
|
|
35
|
+
const [upload] = useCapabilities(Capabilities.FileUploader);
|
|
38
36
|
|
|
39
37
|
useEffect(() => {
|
|
40
38
|
void Storage().then((config) => setStorageConfig(config));
|
|
@@ -52,8 +50,8 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
52
50
|
const fileName = `composer-${new Date().toISOString().replace(/\W/g, '-')}.json`;
|
|
53
51
|
download(file, fileName);
|
|
54
52
|
|
|
55
|
-
if (
|
|
56
|
-
const info = await
|
|
53
|
+
if (upload) {
|
|
54
|
+
const info = await upload(new File([file], fileName), client.spaces.default);
|
|
57
55
|
if (!info) {
|
|
58
56
|
log.error('diagnostics failed to upload to IPFS');
|
|
59
57
|
return;
|
|
@@ -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
|
|
|
@@ -158,7 +158,7 @@ export const DebugSpace: FC<{
|
|
|
158
158
|
<IconButton icon='ph--arrow-clockwise--regular' iconOnly label='Refresh' size={5} onClick={handleUpdate} />
|
|
159
159
|
<IconButton icon='ph--download-simple--regular' iconOnly label='Download' size={5} onClick={handleDownload} />
|
|
160
160
|
|
|
161
|
-
<Toolbar.
|
|
161
|
+
<Toolbar.Separator variant='gap' />
|
|
162
162
|
<IconButton
|
|
163
163
|
icon='ph--flag-pennant--regular'
|
|
164
164
|
iconOnly
|
|
@@ -4,16 +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
|
-
import { log } from '@dxos/log';
|
|
11
10
|
import { getActiveSpace } from '@dxos/plugin-space';
|
|
12
11
|
import { StatusBar } from '@dxos/plugin-status-bar';
|
|
13
12
|
import { ConnectionState } from '@dxos/protocols/proto/dxos/client/services';
|
|
14
13
|
import { useNetworkStatus } from '@dxos/react-client/mesh';
|
|
15
|
-
import { Icon } from '@dxos/react-ui';
|
|
16
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
14
|
+
import { Icon, Popover } from '@dxos/react-ui';
|
|
17
15
|
|
|
18
16
|
const styles = {
|
|
19
17
|
success: 'text-sky-300 dark:text-green-700',
|
|
@@ -67,10 +65,7 @@ const ErrorIndicator = () => {
|
|
|
67
65
|
useEffect(() => {
|
|
68
66
|
const errorListener = (event: any) => {
|
|
69
67
|
const error: Error = event.error ?? event.reason;
|
|
70
|
-
// event.preventDefault();
|
|
71
68
|
if (errorRef.current !== error) {
|
|
72
|
-
// eslint-disable-next-line no-console
|
|
73
|
-
log.error('onError', { event });
|
|
74
69
|
errorRef.current = error;
|
|
75
70
|
forceUpdate({});
|
|
76
71
|
}
|
|
@@ -140,11 +135,9 @@ const SwarmIndicator = () => {
|
|
|
140
135
|
// TODO(burdon): Merge with SaveStatus.
|
|
141
136
|
const SavingIndicator = () => {
|
|
142
137
|
const [state, _setState] = useState(0);
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
const graph = graphPlugin?.provides.graph;
|
|
147
|
-
const _space = location && graph ? getActiveSpace(graph, firstIdInPart(location.active, 'main')) : undefined;
|
|
138
|
+
const layout = useLayout();
|
|
139
|
+
const { graph } = useAppGraph();
|
|
140
|
+
const _space = graph ? getActiveSpace(graph, layout.active[0]) : undefined;
|
|
148
141
|
// TODO(dmaretskyi): Fix this when we have save status for automerge.
|
|
149
142
|
// useEffect(() => {
|
|
150
143
|
// if (!space) {
|
|
@@ -192,22 +185,19 @@ const PerformanceIndicator = () => {
|
|
|
192
185
|
const [stats, refreshStats] = useStats();
|
|
193
186
|
|
|
194
187
|
return (
|
|
195
|
-
|
|
196
|
-
<
|
|
197
|
-
<
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
'overflow-x-hidden overflow-y-auto scrollbar-thin',
|
|
204
|
-
'border-x border-y border-separator',
|
|
205
|
-
)}
|
|
206
|
-
>
|
|
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]'>
|
|
207
196
|
<StatsPanel stats={stats} onRefresh={refreshStats} />
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
197
|
+
<Popover.Arrow />
|
|
198
|
+
</Popover.Content>
|
|
199
|
+
</Popover.Portal>
|
|
200
|
+
</Popover.Root>
|
|
211
201
|
);
|
|
212
202
|
};
|
|
213
203
|
|
|
@@ -3,16 +3,18 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { addressToA1Notation } from '@dxos/compute';
|
|
6
|
-
import {
|
|
6
|
+
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from '@dxos/conductor';
|
|
7
|
+
import { ObjectId, type BaseObject, type TypedObject } from '@dxos/echo-schema';
|
|
8
|
+
import { DXN } from '@dxos/keys';
|
|
7
9
|
import { create, makeRef, type ReactiveObject } from '@dxos/live-object';
|
|
8
|
-
import { DocumentType
|
|
9
|
-
import { createSheet } from '@dxos/plugin-sheet';
|
|
10
|
+
import { DocumentType } from '@dxos/plugin-markdown/types';
|
|
11
|
+
import { createSheet } from '@dxos/plugin-sheet/types';
|
|
10
12
|
import { SheetType, type CellValue } from '@dxos/plugin-sheet/types';
|
|
11
13
|
import { CanvasType, DiagramType } from '@dxos/plugin-sketch/types';
|
|
12
14
|
import { faker } from '@dxos/random';
|
|
13
15
|
import { Filter, type Space } from '@dxos/react-client/echo';
|
|
14
16
|
import { TableType } from '@dxos/react-ui-table';
|
|
15
|
-
import { createView } from '@dxos/schema';
|
|
17
|
+
import { createView, TextType } from '@dxos/schema';
|
|
16
18
|
import { createAsyncGenerator, type ValueGenerator } from '@dxos/schema/testing';
|
|
17
19
|
import { range } from '@dxos/util';
|
|
18
20
|
|
|
@@ -37,15 +39,13 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
37
39
|
DocumentType.typename,
|
|
38
40
|
async (space, n, cb) => {
|
|
39
41
|
const objects = range(n).map(() => {
|
|
40
|
-
|
|
42
|
+
return space.db.add(
|
|
41
43
|
create(DocumentType, {
|
|
42
44
|
name: faker.commerce.productName(),
|
|
43
45
|
content: makeRef(create(TextType, { content: faker.lorem.sentences(5) })),
|
|
44
46
|
threads: [],
|
|
45
47
|
}),
|
|
46
48
|
);
|
|
47
|
-
|
|
48
|
-
return obj;
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
cb?.(objects);
|
|
@@ -109,6 +109,33 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
109
109
|
return objects;
|
|
110
110
|
},
|
|
111
111
|
],
|
|
112
|
+
[
|
|
113
|
+
ComputeGraph.typename,
|
|
114
|
+
async (space, n, cb) => {
|
|
115
|
+
const objects = range(n, () => {
|
|
116
|
+
const model = ComputeGraphModel.create();
|
|
117
|
+
model.builder
|
|
118
|
+
.createNode({ id: 'gpt-INPUT', type: NODE_INPUT })
|
|
119
|
+
.createNode({ id: 'gpt-GPT', type: 'gpt' })
|
|
120
|
+
.createNode({
|
|
121
|
+
id: 'gpt-QUEUE_ID',
|
|
122
|
+
type: 'constant',
|
|
123
|
+
value: new DXN(DXN.kind.QUEUE, ['data', space.id, ObjectId.random()]).toString(),
|
|
124
|
+
})
|
|
125
|
+
.createNode({ id: 'gpt-APPEND', type: 'append' })
|
|
126
|
+
.createNode({ id: 'gpt-OUTPUT', type: NODE_OUTPUT })
|
|
127
|
+
.createEdge({ node: 'gpt-INPUT', property: 'prompt' }, { node: 'gpt-GPT', property: 'prompt' })
|
|
128
|
+
.createEdge({ node: 'gpt-GPT', property: 'text' }, { node: 'gpt-OUTPUT', property: 'text' })
|
|
129
|
+
.createEdge({ node: 'gpt-QUEUE_ID', property: DEFAULT_OUTPUT }, { node: 'gpt-APPEND', property: 'id' })
|
|
130
|
+
.createEdge({ node: 'gpt-GPT', property: 'messages' }, { node: 'gpt-APPEND', property: 'items' })
|
|
131
|
+
.createEdge({ node: 'gpt-QUEUE_ID', property: DEFAULT_OUTPUT }, { node: 'gpt-OUTPUT', property: 'queue' });
|
|
132
|
+
|
|
133
|
+
return space.db.add(model.root);
|
|
134
|
+
});
|
|
135
|
+
cb?.(objects);
|
|
136
|
+
return objects;
|
|
137
|
+
},
|
|
138
|
+
],
|
|
112
139
|
]);
|
|
113
140
|
|
|
114
141
|
export const createGenerator = <T extends BaseObject>(type: TypedObject<T>): ObjectGenerator<T> => {
|