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