@dxos/plugin-debug 0.8.4-main.ae835ea → 0.8.4-main.bc674ce
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/DebugGraph-6VMEOKEV.mjs +15 -0
- package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs.map +7 -0
- package/dist/lib/browser/DevtoolsOverviewContainer-77PKFLYV.mjs +19 -0
- package/dist/lib/browser/DevtoolsOverviewContainer-77PKFLYV.mjs.map +7 -0
- package/dist/lib/browser/{SpaceGenerator-7Q7CX64P.mjs → SpaceGenerator-H33AEFGC.mjs} +226 -233
- package/dist/lib/browser/SpaceGenerator-H33AEFGC.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-LV73R7HR.mjs +598 -0
- package/dist/lib/browser/app-graph-builder-LV73R7HR.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SRV2AIGJ.mjs → chunk-4UFQXPP7.mjs} +11 -1
- package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WZFZ4ESO.mjs → chunk-A5H5GRV6.mjs} +1 -1
- package/dist/lib/browser/chunk-A5H5GRV6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +34 -39
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-FSWBT3MH.mjs +17 -0
- package/dist/lib/browser/react-context-FSWBT3MH.mjs.map +7 -0
- package/dist/lib/browser/react-surface-2N6CPSHR.mjs +757 -0
- package/dist/lib/browser/react-surface-2N6CPSHR.mjs.map +7 -0
- package/dist/lib/browser/settings-KA4GN73K.mjs +31 -0
- package/dist/lib/browser/settings-KA4GN73K.mjs.map +7 -0
- package/dist/types/src/DebugPlugin.d.ts +2 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -8
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context/index.d.ts +7 -0
- package/dist/types/src/capabilities/react-context/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-context/react-context.d.ts +10 -0
- package/dist/types/src/capabilities/react-context/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +3 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +5 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/components/DebugGraph.d.ts +5 -4
- package/dist/types/src/components/DebugGraph.d.ts.map +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts +4 -2
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +5 -5
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +2 -5
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts +2 -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 +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -1
- package/dist/types/src/types.d.ts +5 -0
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +76 -70
- package/src/DebugPlugin.tsx +16 -31
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +420 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/index.ts +4 -6
- package/src/capabilities/react-context/index.ts +7 -0
- package/src/capabilities/react-context/react-context.tsx +20 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +409 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +30 -0
- package/src/components/DebugGraph.tsx +4 -3
- package/src/components/DebugObjectPanel.tsx +4 -4
- package/src/components/DebugSettings.tsx +44 -18
- package/src/components/DevtoolsOverviewContainer.tsx +1 -1
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +18 -19
- package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +7 -5
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +18 -13
- package/src/components/SpaceGenerator/presets.ts +217 -100
- package/src/components/Wireframe.tsx +4 -5
- package/src/components/index.ts +4 -1
- package/src/meta.ts +2 -2
- package/src/translations.ts +1 -1
- package/src/types.ts +8 -0
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +0 -20
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +0 -7
- package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs +0 -25
- package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-7Q7CX64P.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-RXWTHLEW.mjs +0 -588
- package/dist/lib/browser/app-graph-builder-RXWTHLEW.mjs.map +0 -7
- package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +0 -7
- package/dist/lib/browser/react-context-P2YDWEWI.mjs +0 -16
- package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +0 -7
- package/dist/lib/browser/react-surface-4XGZUT3Z.mjs +0 -772
- package/dist/lib/browser/react-surface-4XGZUT3Z.mjs.map +0 -7
- package/dist/lib/browser/settings-SQXR3OAH.mjs +0 -22
- package/dist/lib/browser/settings-SQXR3OAH.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-context.d.ts +0 -8
- package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -431
- package/src/capabilities/react-context.tsx +0 -16
- package/src/capabilities/react-surface.tsx +0 -399
- package/src/capabilities/settings.ts +0 -19
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export const ReactSurface = lazy(() => import('./react-surface'));
|
|
10
|
-
export const DebugSettings = lazy(() => import('./settings'));
|
|
5
|
+
export * from './app-graph-builder';
|
|
6
|
+
export * from './react-context';
|
|
7
|
+
export * from './react-surface';
|
|
8
|
+
export * from './settings';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
9
|
+
import { DevtoolsContextProvider } from '@dxos/devtools';
|
|
10
|
+
|
|
11
|
+
import { meta } from '../../meta';
|
|
12
|
+
|
|
13
|
+
export default Capability.makeModule(() =>
|
|
14
|
+
Effect.succeed(
|
|
15
|
+
Capability.contributes(Common.Capability.ReactContext, {
|
|
16
|
+
id: meta.id,
|
|
17
|
+
context: ({ children }) => <DevtoolsContextProvider>{children}</DevtoolsContextProvider>,
|
|
18
|
+
}),
|
|
19
|
+
),
|
|
20
|
+
);
|
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React, { useCallback } from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
9
|
+
import { useCapability, useLayout, useOperationInvoker, useSettingsState } from '@dxos/app-framework/react';
|
|
10
|
+
import {
|
|
11
|
+
AutomergePanel,
|
|
12
|
+
ConfigPanel,
|
|
13
|
+
CredentialsPanel,
|
|
14
|
+
DeviceListPanel,
|
|
15
|
+
DiagnosticsPanel,
|
|
16
|
+
EdgeDashboardPanel,
|
|
17
|
+
FeedsPanel,
|
|
18
|
+
IdentityPanel,
|
|
19
|
+
InvocationTraceContainer,
|
|
20
|
+
KeyringPanel,
|
|
21
|
+
LoggingPanel,
|
|
22
|
+
MembersPanel,
|
|
23
|
+
MetadataPanel,
|
|
24
|
+
NetworkPanel,
|
|
25
|
+
ObjectsPanel,
|
|
26
|
+
QueuesPanel,
|
|
27
|
+
SchemaPanel,
|
|
28
|
+
SignalPanel,
|
|
29
|
+
SpaceInfoPanel,
|
|
30
|
+
SpaceListPanel,
|
|
31
|
+
StoragePanel,
|
|
32
|
+
SwarmPanel,
|
|
33
|
+
TestingPanel,
|
|
34
|
+
TracingPanel,
|
|
35
|
+
WorkflowPanel,
|
|
36
|
+
} from '@dxos/devtools';
|
|
37
|
+
import { Obj } from '@dxos/echo';
|
|
38
|
+
import { log } from '@dxos/log';
|
|
39
|
+
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
40
|
+
import { type Graph } from '@dxos/plugin-graph';
|
|
41
|
+
import { ScriptOperation } from '@dxos/plugin-script/types';
|
|
42
|
+
import { SpaceOperation } from '@dxos/plugin-space/types';
|
|
43
|
+
import { type Space, SpaceState, isSpace, parseId } from '@dxos/react-client/echo';
|
|
44
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
45
|
+
import { Collection } from '@dxos/schema';
|
|
46
|
+
|
|
47
|
+
import {
|
|
48
|
+
DebugGraph,
|
|
49
|
+
DebugObjectPanel,
|
|
50
|
+
DebugSettings,
|
|
51
|
+
DebugStatus,
|
|
52
|
+
DevtoolsOverviewContainer,
|
|
53
|
+
SpaceGenerator,
|
|
54
|
+
Wireframe,
|
|
55
|
+
} from '../../components';
|
|
56
|
+
import { meta } from '../../meta';
|
|
57
|
+
import { DebugCapabilities, type DebugSettingsProps, Devtools } from '../../types';
|
|
58
|
+
|
|
59
|
+
type SpaceDebug = {
|
|
60
|
+
type: string;
|
|
61
|
+
space: Space;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
type GraphDebug = {
|
|
65
|
+
graph: Graph.Graph;
|
|
66
|
+
root: string;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${meta.id}/space` && isSpace(data.space);
|
|
70
|
+
const isGraphDebug = (data: any): data is GraphDebug => {
|
|
71
|
+
const graph = data?.graph;
|
|
72
|
+
return (
|
|
73
|
+
graph != null && typeof graph === 'object' && typeof graph.json === 'function' && typeof data?.root === 'string'
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// TODO(wittjosiah): Factor out?
|
|
78
|
+
const useCurrentSpace = () => {
|
|
79
|
+
const layout = useLayout();
|
|
80
|
+
const client = useCapability(ClientCapabilities.Client);
|
|
81
|
+
const { spaceId } = parseId(layout.workspace);
|
|
82
|
+
const space = spaceId ? client.spaces.get(spaceId) : undefined;
|
|
83
|
+
return space;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default Capability.makeModule(
|
|
87
|
+
Effect.fnUntraced(function* () {
|
|
88
|
+
const capabilities = yield* Capability.Service;
|
|
89
|
+
const registry = capabilities.get(Common.Capability.AtomRegistry);
|
|
90
|
+
const settingsAtom = capabilities.get(DebugCapabilities.Settings);
|
|
91
|
+
|
|
92
|
+
return Capability.contributes(Common.Capability.ReactSurface, [
|
|
93
|
+
Common.createSurface({
|
|
94
|
+
id: `${meta.id}/plugin-settings`,
|
|
95
|
+
role: 'article',
|
|
96
|
+
filter: (data): data is { subject: Common.Capability.Settings } =>
|
|
97
|
+
Common.Capability.isSettings(data.subject) && data.subject.prefix === meta.id,
|
|
98
|
+
component: ({ data: { subject } }) => {
|
|
99
|
+
const { settings, updateSettings } = useSettingsState<DebugSettingsProps>(subject.atom);
|
|
100
|
+
return <DebugSettings settings={settings} onSettingsChange={updateSettings} />;
|
|
101
|
+
},
|
|
102
|
+
}),
|
|
103
|
+
Common.createSurface({
|
|
104
|
+
id: `${meta.id}/space`,
|
|
105
|
+
role: 'article',
|
|
106
|
+
filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),
|
|
107
|
+
component: ({ role, data }) => {
|
|
108
|
+
const { invokePromise } = useOperationInvoker();
|
|
109
|
+
|
|
110
|
+
const handleCreateObject = useCallback(
|
|
111
|
+
(objects: Obj.Unknown[]) => {
|
|
112
|
+
if (!isSpace(data.subject.space)) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const collection =
|
|
117
|
+
data.subject.space.state.get() === SpaceState.SPACE_READY &&
|
|
118
|
+
data.subject.space.properties[Collection.Collection.typename]?.target;
|
|
119
|
+
if (!Obj.instanceOf(Collection.Collection, collection)) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
objects.forEach((object) => {
|
|
124
|
+
void invokePromise(SpaceOperation.AddObject, {
|
|
125
|
+
target: collection,
|
|
126
|
+
object,
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
},
|
|
130
|
+
[data.subject.space, invokePromise],
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<Layout.Main role={role}>
|
|
135
|
+
<SpaceGenerator space={data.subject.space} onCreateObjects={handleCreateObject} />
|
|
136
|
+
</Layout.Main>
|
|
137
|
+
);
|
|
138
|
+
},
|
|
139
|
+
}),
|
|
140
|
+
Common.createSurface({
|
|
141
|
+
id: `${meta.id}/app-graph`,
|
|
142
|
+
role: 'article',
|
|
143
|
+
filter: (data): data is { subject: GraphDebug } => isGraphDebug(data.subject),
|
|
144
|
+
component: ({ data }) => <DebugGraph graph={data.subject.graph} root={data.subject.root} />,
|
|
145
|
+
}),
|
|
146
|
+
Common.createSurface({
|
|
147
|
+
id: `${meta.id}/wireframe`,
|
|
148
|
+
role: ['article', 'section'],
|
|
149
|
+
position: 'hoist',
|
|
150
|
+
filter: (data): data is { subject: Obj.Unknown } => {
|
|
151
|
+
const settings = registry.get(settingsAtom);
|
|
152
|
+
return Obj.isObject(data.subject) && !!settings.wireframe;
|
|
153
|
+
},
|
|
154
|
+
component: ({ data, role }) => (
|
|
155
|
+
<Wireframe label={`${role}:${name}`} object={data.subject} classNames='row-span-2 overflow-hidden' />
|
|
156
|
+
),
|
|
157
|
+
}),
|
|
158
|
+
Common.createSurface({
|
|
159
|
+
id: `${meta.id}/object-debug`,
|
|
160
|
+
role: 'article',
|
|
161
|
+
filter: (data): data is { companionTo: Obj.Unknown } =>
|
|
162
|
+
data.subject === 'debug' && Obj.isObject(data.companionTo),
|
|
163
|
+
component: ({ data }) => <DebugObjectPanel object={data.companionTo} />,
|
|
164
|
+
}),
|
|
165
|
+
Common.createSurface({
|
|
166
|
+
id: `${meta.id}/devtools-overview`,
|
|
167
|
+
role: 'deck-companion--devtools',
|
|
168
|
+
component: () => <DevtoolsOverviewContainer />,
|
|
169
|
+
}),
|
|
170
|
+
Common.createSurface({
|
|
171
|
+
id: `${meta.id}/status`,
|
|
172
|
+
role: 'status',
|
|
173
|
+
component: () => <DebugStatus />,
|
|
174
|
+
}),
|
|
175
|
+
|
|
176
|
+
//
|
|
177
|
+
// Devtools
|
|
178
|
+
//
|
|
179
|
+
|
|
180
|
+
Common.createSurface({
|
|
181
|
+
id: `${meta.id}/client/config`,
|
|
182
|
+
role: 'article',
|
|
183
|
+
filter: (data): data is any => data.subject === Devtools.Client.Config,
|
|
184
|
+
component: () => <ConfigPanel vaultSelector={false} />,
|
|
185
|
+
}),
|
|
186
|
+
Common.createSurface({
|
|
187
|
+
id: `${meta.id}/client/storage`,
|
|
188
|
+
role: 'article',
|
|
189
|
+
filter: (data): data is any => data.subject === Devtools.Client.Storage,
|
|
190
|
+
component: () => <StoragePanel />,
|
|
191
|
+
}),
|
|
192
|
+
Common.createSurface({
|
|
193
|
+
id: `${meta.id}/client/logs`,
|
|
194
|
+
role: 'article',
|
|
195
|
+
filter: (data): data is any => data.subject === Devtools.Client.Logs,
|
|
196
|
+
component: () => <LoggingPanel />,
|
|
197
|
+
}),
|
|
198
|
+
Common.createSurface({
|
|
199
|
+
id: `${meta.id}/client/diagnostics`,
|
|
200
|
+
role: 'article',
|
|
201
|
+
filter: (data): data is any => data.subject === Devtools.Client.Diagnostics,
|
|
202
|
+
component: () => <DiagnosticsPanel />,
|
|
203
|
+
}),
|
|
204
|
+
Common.createSurface({
|
|
205
|
+
id: `${meta.id}/client/tracing`,
|
|
206
|
+
role: 'article',
|
|
207
|
+
filter: (data): data is any => data.subject === Devtools.Client.Tracing,
|
|
208
|
+
component: () => <TracingPanel />,
|
|
209
|
+
}),
|
|
210
|
+
Common.createSurface({
|
|
211
|
+
id: `${meta.id}/halo/identity`,
|
|
212
|
+
role: 'article',
|
|
213
|
+
filter: (data): data is any => data.subject === Devtools.Halo.Identity,
|
|
214
|
+
component: () => <IdentityPanel />,
|
|
215
|
+
}),
|
|
216
|
+
Common.createSurface({
|
|
217
|
+
id: `${meta.id}/halo/devices`,
|
|
218
|
+
role: 'article',
|
|
219
|
+
filter: (data): data is any => data.subject === Devtools.Halo.Devices,
|
|
220
|
+
component: () => <DeviceListPanel />,
|
|
221
|
+
}),
|
|
222
|
+
Common.createSurface({
|
|
223
|
+
id: `${meta.id}/halo/keyring`,
|
|
224
|
+
role: 'article',
|
|
225
|
+
filter: (data): data is any => data.subject === Devtools.Halo.Keyring,
|
|
226
|
+
component: () => <KeyringPanel />,
|
|
227
|
+
}),
|
|
228
|
+
Common.createSurface({
|
|
229
|
+
id: `${meta.id}/halo/credentials`,
|
|
230
|
+
role: 'article',
|
|
231
|
+
filter: (data): data is any => data.subject === Devtools.Halo.Credentials,
|
|
232
|
+
component: () => {
|
|
233
|
+
const space = useCurrentSpace();
|
|
234
|
+
return <CredentialsPanel space={space} />;
|
|
235
|
+
},
|
|
236
|
+
}),
|
|
237
|
+
Common.createSurface({
|
|
238
|
+
id: `${meta.id}/echo/spaces`,
|
|
239
|
+
role: 'article',
|
|
240
|
+
filter: (data): data is any => data.subject === Devtools.Echo.Spaces,
|
|
241
|
+
component: () => {
|
|
242
|
+
const { invokePromise } = useOperationInvoker();
|
|
243
|
+
const handleSelect = useCallback(
|
|
244
|
+
() => invokePromise(Common.LayoutOperation.Open, { subject: [Devtools.Echo.Space] }),
|
|
245
|
+
[invokePromise],
|
|
246
|
+
);
|
|
247
|
+
return <SpaceListPanel onSelect={handleSelect} />;
|
|
248
|
+
},
|
|
249
|
+
}),
|
|
250
|
+
Common.createSurface({
|
|
251
|
+
id: `${meta.id}/echo/space`,
|
|
252
|
+
role: 'article',
|
|
253
|
+
filter: (data): data is any => data.subject === Devtools.Echo.Space,
|
|
254
|
+
component: () => {
|
|
255
|
+
const space = useCurrentSpace();
|
|
256
|
+
const { invokePromise } = useOperationInvoker();
|
|
257
|
+
const handleSelect = useCallback(
|
|
258
|
+
() => invokePromise(Common.LayoutOperation.Open, { subject: [Devtools.Echo.Feeds] }),
|
|
259
|
+
[invokePromise],
|
|
260
|
+
);
|
|
261
|
+
return <SpaceInfoPanel space={space} onSelectFeed={handleSelect} onSelectPipeline={handleSelect} />;
|
|
262
|
+
},
|
|
263
|
+
}),
|
|
264
|
+
Common.createSurface({
|
|
265
|
+
id: `${meta.id}/echo/feeds`,
|
|
266
|
+
role: 'article',
|
|
267
|
+
filter: (data): data is any => data.subject === Devtools.Echo.Feeds,
|
|
268
|
+
component: () => {
|
|
269
|
+
const space = useCurrentSpace();
|
|
270
|
+
return <FeedsPanel space={space} />;
|
|
271
|
+
},
|
|
272
|
+
}),
|
|
273
|
+
Common.createSurface({
|
|
274
|
+
id: `${meta.id}/echo/objects`,
|
|
275
|
+
role: 'article',
|
|
276
|
+
filter: (data): data is any => data.subject === Devtools.Echo.Objects,
|
|
277
|
+
component: () => {
|
|
278
|
+
const space = useCurrentSpace();
|
|
279
|
+
return <ObjectsPanel space={space} />;
|
|
280
|
+
},
|
|
281
|
+
}),
|
|
282
|
+
Common.createSurface({
|
|
283
|
+
id: `${meta.id}/echo/schema`,
|
|
284
|
+
role: 'article',
|
|
285
|
+
filter: (data): data is any => data.subject === Devtools.Echo.Schema,
|
|
286
|
+
component: () => {
|
|
287
|
+
const space = useCurrentSpace();
|
|
288
|
+
return <SchemaPanel space={space} />;
|
|
289
|
+
},
|
|
290
|
+
}),
|
|
291
|
+
Common.createSurface({
|
|
292
|
+
id: `${meta.id}/echo/automerge`,
|
|
293
|
+
role: 'article',
|
|
294
|
+
filter: (data): data is any => data.subject === Devtools.Echo.Automerge,
|
|
295
|
+
component: () => {
|
|
296
|
+
const space = useCurrentSpace();
|
|
297
|
+
return <AutomergePanel space={space} />;
|
|
298
|
+
},
|
|
299
|
+
}),
|
|
300
|
+
Common.createSurface({
|
|
301
|
+
id: `${meta.id}/echo/queues`,
|
|
302
|
+
role: 'article',
|
|
303
|
+
filter: (data): data is any => data.subject === Devtools.Echo.Queues,
|
|
304
|
+
component: () => <QueuesPanel />,
|
|
305
|
+
}),
|
|
306
|
+
Common.createSurface({
|
|
307
|
+
id: `${meta.id}/echo/members`,
|
|
308
|
+
role: 'article',
|
|
309
|
+
filter: (data): data is any => data.subject === Devtools.Echo.Members,
|
|
310
|
+
component: () => {
|
|
311
|
+
const space = useCurrentSpace();
|
|
312
|
+
return <MembersPanel space={space} />;
|
|
313
|
+
},
|
|
314
|
+
}),
|
|
315
|
+
Common.createSurface({
|
|
316
|
+
id: `${meta.id}/echo/metadata`,
|
|
317
|
+
role: 'article',
|
|
318
|
+
filter: (data): data is any => data.subject === Devtools.Echo.Metadata,
|
|
319
|
+
component: () => <MetadataPanel />,
|
|
320
|
+
}),
|
|
321
|
+
Common.createSurface({
|
|
322
|
+
id: `${meta.id}/mesh/signal`,
|
|
323
|
+
role: 'article',
|
|
324
|
+
filter: (data): data is any => data.subject === Devtools.Mesh.Signal,
|
|
325
|
+
component: () => <SignalPanel />,
|
|
326
|
+
}),
|
|
327
|
+
Common.createSurface({
|
|
328
|
+
id: `${meta.id}/mesh/swarm`,
|
|
329
|
+
role: 'article',
|
|
330
|
+
filter: (data): data is any => data.subject === Devtools.Mesh.Swarm,
|
|
331
|
+
component: () => <SwarmPanel />,
|
|
332
|
+
}),
|
|
333
|
+
Common.createSurface({
|
|
334
|
+
id: `${meta.id}/mesh/network`,
|
|
335
|
+
role: 'article',
|
|
336
|
+
filter: (data): data is any => data.subject === Devtools.Mesh.Network,
|
|
337
|
+
component: () => {
|
|
338
|
+
const space = useCurrentSpace();
|
|
339
|
+
return <NetworkPanel space={space} />;
|
|
340
|
+
},
|
|
341
|
+
}),
|
|
342
|
+
// TODO(wittjosiah): Remove?
|
|
343
|
+
// createSurface({
|
|
344
|
+
// id: `${meta.id}/agent/dashboard`,
|
|
345
|
+
// role: 'article',
|
|
346
|
+
// filter: (data): data is any => data.subject === Devtools.Agent.Dashboard,
|
|
347
|
+
// component: () => <DashboardPanel />,
|
|
348
|
+
// }),
|
|
349
|
+
Common.createSurface({
|
|
350
|
+
id: `${meta.id}/edge/dashboard`,
|
|
351
|
+
role: 'article',
|
|
352
|
+
filter: (data): data is any => data.subject === Devtools.Edge.Dashboard,
|
|
353
|
+
component: () => <EdgeDashboardPanel />,
|
|
354
|
+
}),
|
|
355
|
+
Common.createSurface({
|
|
356
|
+
id: `${meta.id}/edge/workflows`,
|
|
357
|
+
role: 'article',
|
|
358
|
+
filter: (data): data is any => data.subject === Devtools.Edge.Workflows,
|
|
359
|
+
component: () => {
|
|
360
|
+
const space = useCurrentSpace();
|
|
361
|
+
return <WorkflowPanel space={space} />;
|
|
362
|
+
},
|
|
363
|
+
}),
|
|
364
|
+
Common.createSurface({
|
|
365
|
+
id: `${meta.id}/edge/traces`,
|
|
366
|
+
role: 'article',
|
|
367
|
+
filter: (data): data is any => data.subject === Devtools.Edge.Traces,
|
|
368
|
+
component: () => {
|
|
369
|
+
const space = useCurrentSpace();
|
|
370
|
+
const queueDxn = space?.properties.invocationTraceQueue?.dxn;
|
|
371
|
+
return <InvocationTraceContainer db={space?.db} queueDxn={queueDxn} detailAxis='block' />;
|
|
372
|
+
},
|
|
373
|
+
}),
|
|
374
|
+
Common.createSurface({
|
|
375
|
+
id: `${meta.id}/edge/testing`,
|
|
376
|
+
role: 'article',
|
|
377
|
+
filter: (data): data is any => data.subject === Devtools.Edge.Testing,
|
|
378
|
+
component: () => {
|
|
379
|
+
const { invokePromise } = useOperationInvoker();
|
|
380
|
+
const onSpaceCreate = useCallback(
|
|
381
|
+
async (space: Space) => {
|
|
382
|
+
await space.waitUntilReady();
|
|
383
|
+
await invokePromise(SpaceOperation.Migrate, { space });
|
|
384
|
+
await space.db.flush();
|
|
385
|
+
},
|
|
386
|
+
[invokePromise],
|
|
387
|
+
);
|
|
388
|
+
const onScriptPluginOpen = useCallback(
|
|
389
|
+
async (space: Space) => {
|
|
390
|
+
await space.waitUntilReady();
|
|
391
|
+
const createResult = await invokePromise(ScriptOperation.CreateScript, { db: space.db });
|
|
392
|
+
if (createResult.data?.object) {
|
|
393
|
+
await invokePromise(SpaceOperation.AddObject, { target: space.db, object: createResult.data.object });
|
|
394
|
+
}
|
|
395
|
+
log.info('script created', { result: createResult });
|
|
396
|
+
if (createResult.data?.object?.id) {
|
|
397
|
+
await invokePromise(Common.LayoutOperation.Open, {
|
|
398
|
+
subject: [`${space.id}:${createResult.data.object.id}`],
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
[invokePromise],
|
|
403
|
+
);
|
|
404
|
+
return <TestingPanel onSpaceCreate={onSpaceCreate} onScriptPluginOpen={onScriptPluginOpen} />;
|
|
405
|
+
},
|
|
406
|
+
}),
|
|
407
|
+
]);
|
|
408
|
+
}),
|
|
409
|
+
);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
+
import { createKvsStore } from '@dxos/effect';
|
|
9
|
+
|
|
10
|
+
import { meta } from '../../meta';
|
|
11
|
+
import { DebugCapabilities, DebugSettingsSchema } from '../../types';
|
|
12
|
+
|
|
13
|
+
export default Capability.makeModule(() =>
|
|
14
|
+
Effect.sync(() => {
|
|
15
|
+
const settingsAtom = createKvsStore({
|
|
16
|
+
key: meta.id,
|
|
17
|
+
schema: DebugSettingsSchema,
|
|
18
|
+
defaultValue: () => ({}),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return [
|
|
22
|
+
Capability.contributes(DebugCapabilities.Settings, settingsAtom),
|
|
23
|
+
Capability.contributes(Common.Capability.Settings, {
|
|
24
|
+
prefix: meta.id,
|
|
25
|
+
schema: DebugSettingsSchema,
|
|
26
|
+
atom: settingsAtom,
|
|
27
|
+
}),
|
|
28
|
+
];
|
|
29
|
+
}),
|
|
30
|
+
);
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
import React, { type FC } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Tree } from '@dxos/devtools';
|
|
8
|
-
import {
|
|
8
|
+
import { Graph } from '@dxos/plugin-graph';
|
|
9
9
|
|
|
10
|
-
export
|
|
11
|
-
|
|
10
|
+
export type DebugGraphProps = { graph: Graph.Graph; root: string };
|
|
11
|
+
export const DebugGraph: FC<DebugGraphProps> = ({ graph, root }) => {
|
|
12
|
+
return <Tree data={Graph.toJSON(graph, root)} />;
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
export default DebugGraph;
|
|
@@ -6,11 +6,11 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { type Obj } from '@dxos/echo';
|
|
8
8
|
import { Clipboard, Input, Toolbar } from '@dxos/react-ui';
|
|
9
|
-
import {
|
|
9
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
10
10
|
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
11
11
|
|
|
12
12
|
export type DebugObjectPanelProps = {
|
|
13
|
-
object: Obj.
|
|
13
|
+
object: Obj.Unknown;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
// TODO(burdon): Get schema and traverse references.
|
|
@@ -19,7 +19,7 @@ export const DebugObjectPanel = ({ object }: DebugObjectPanelProps) => {
|
|
|
19
19
|
|
|
20
20
|
return (
|
|
21
21
|
<Clipboard.Provider>
|
|
22
|
-
<
|
|
22
|
+
<Layout.Main toolbar>
|
|
23
23
|
<Toolbar.Root>
|
|
24
24
|
<Input.Root>
|
|
25
25
|
<Input.TextInput disabled value={dxn} />
|
|
@@ -27,7 +27,7 @@ export const DebugObjectPanel = ({ object }: DebugObjectPanelProps) => {
|
|
|
27
27
|
</Input.Root>
|
|
28
28
|
</Toolbar.Root>
|
|
29
29
|
<Json data={object} />
|
|
30
|
-
</
|
|
30
|
+
</Layout.Main>
|
|
31
31
|
</Clipboard.Provider>
|
|
32
32
|
);
|
|
33
33
|
};
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Common } from '@dxos/app-framework';
|
|
8
|
+
import { useCapabilities } from '@dxos/app-framework/react';
|
|
8
9
|
import { type ConfigProto, SaveConfig, Storage, defs } from '@dxos/config';
|
|
9
10
|
import { log } from '@dxos/log';
|
|
10
11
|
import { useClient } from '@dxos/react-client';
|
|
11
|
-
import {
|
|
12
|
+
import { Icon, IconButton, Input, Select, Toast, useFileDownload, useTranslation } from '@dxos/react-ui';
|
|
12
13
|
import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from '@dxos/react-ui-form';
|
|
13
14
|
import { setDeep } from '@dxos/util';
|
|
14
15
|
|
|
@@ -25,14 +26,19 @@ const StorageAdapters = {
|
|
|
25
26
|
idb: defs.Runtime.Client.Storage.StorageDriver.IDB,
|
|
26
27
|
} as const;
|
|
27
28
|
|
|
28
|
-
export
|
|
29
|
+
export type DebugSettingsComponentProps = {
|
|
30
|
+
settings: DebugSettingsProps;
|
|
31
|
+
onSettingsChange: (fn: (current: DebugSettingsProps) => DebugSettingsProps) => void;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const DebugSettings = ({ settings, onSettingsChange }: DebugSettingsComponentProps) => {
|
|
29
35
|
const { t } = useTranslation(meta.id);
|
|
30
36
|
const [toast, setToast] = useState<Toast>();
|
|
31
37
|
const client = useClient();
|
|
32
38
|
const download = useFileDownload();
|
|
33
39
|
// TODO(mykola): Get updates from other places that change Config.
|
|
34
40
|
const [storageConfig, setStorageConfig] = useState<ConfigProto>({});
|
|
35
|
-
const [upload] = useCapabilities(
|
|
41
|
+
const [upload] = useCapabilities(Common.Capability.FileUploader);
|
|
36
42
|
|
|
37
43
|
useEffect(() => {
|
|
38
44
|
void Storage().then((config) => setStorageConfig(config));
|
|
@@ -46,22 +52,30 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
46
52
|
|
|
47
53
|
const handleDownload = async () => {
|
|
48
54
|
const data = await client.diagnostics();
|
|
49
|
-
const file = new Blob([JSON.stringify(data, undefined, 2)], {
|
|
55
|
+
const file = new Blob([JSON.stringify(data, undefined, 2)], {
|
|
56
|
+
type: 'text/plain',
|
|
57
|
+
});
|
|
50
58
|
const fileName = `composer-${new Date().toISOString().replace(/\W/g, '-')}.json`;
|
|
51
59
|
download(file, fileName);
|
|
52
60
|
|
|
53
61
|
if (upload) {
|
|
54
|
-
const info = await upload(client.spaces.default, new File([file], fileName));
|
|
62
|
+
const info = await upload(client.spaces.default.db, new File([file], fileName));
|
|
55
63
|
if (!info) {
|
|
56
64
|
log.error('diagnostics failed to upload to IPFS');
|
|
57
65
|
return;
|
|
58
66
|
}
|
|
59
|
-
handleToast({
|
|
67
|
+
handleToast({
|
|
68
|
+
title: t('settings uploaded'),
|
|
69
|
+
description: t('settings uploaded to clipboard'),
|
|
70
|
+
});
|
|
60
71
|
|
|
61
72
|
// TODO(nf): move to IpfsPlugin?
|
|
62
73
|
const url = client.config.values.runtime!.services!.ipfs!.gateway + '/' + info.cid;
|
|
63
74
|
void navigator.clipboard.writeText(url);
|
|
64
|
-
handleToast({
|
|
75
|
+
handleToast({
|
|
76
|
+
title: t('settings uploaded'),
|
|
77
|
+
description: t('settings uploaded to clipboard'),
|
|
78
|
+
});
|
|
65
79
|
log.info('diagnostics', { url });
|
|
66
80
|
}
|
|
67
81
|
};
|
|
@@ -70,9 +84,15 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
70
84
|
try {
|
|
71
85
|
const info = await client.repair();
|
|
72
86
|
setStorageConfig(await Storage());
|
|
73
|
-
handleToast({
|
|
87
|
+
handleToast({
|
|
88
|
+
title: t('settings repair success'),
|
|
89
|
+
description: JSON.stringify(info, undefined, 2),
|
|
90
|
+
});
|
|
74
91
|
} catch (err: any) {
|
|
75
|
-
handleToast({
|
|
92
|
+
handleToast({
|
|
93
|
+
title: t('settings repair failed'),
|
|
94
|
+
description: err.message,
|
|
95
|
+
});
|
|
76
96
|
}
|
|
77
97
|
};
|
|
78
98
|
|
|
@@ -83,18 +103,24 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
83
103
|
<ControlItemInput title={t('settings wireframe')}>
|
|
84
104
|
<Input.Switch
|
|
85
105
|
checked={settings.wireframe}
|
|
86
|
-
onCheckedChange={(checked) => (
|
|
106
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, wireframe: !!checked }))}
|
|
87
107
|
/>
|
|
88
108
|
</ControlItemInput>
|
|
89
109
|
<ControlItemInput title={t('settings download diagnostics')}>
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
110
|
+
<IconButton
|
|
111
|
+
icon='ph--download-simple--regular'
|
|
112
|
+
iconOnly
|
|
113
|
+
label={t('settings download diagnostics')}
|
|
114
|
+
onClick={handleDownload}
|
|
115
|
+
/>
|
|
93
116
|
</ControlItemInput>
|
|
94
117
|
<ControlItemInput title={t('settings repair')}>
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
118
|
+
<IconButton
|
|
119
|
+
icon='ph--first-aid-kit--regular'
|
|
120
|
+
iconOnly
|
|
121
|
+
label={t('settings repair')}
|
|
122
|
+
onClick={handleRepair}
|
|
123
|
+
/>
|
|
98
124
|
</ControlItemInput>
|
|
99
125
|
|
|
100
126
|
{/* TODO(burdon): Move to layout? */}
|
|
@@ -114,7 +140,7 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
114
140
|
<Select.Root
|
|
115
141
|
value={
|
|
116
142
|
Object.entries(StorageAdapters).find(
|
|
117
|
-
([
|
|
143
|
+
([_name, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore,
|
|
118
144
|
)?.[0]
|
|
119
145
|
}
|
|
120
146
|
onValueChange={(value) => {
|