@dxos/plugin-debug 0.8.4-main.9735255 → 0.8.4-main.abd8ff62ef

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.
Files changed (180) hide show
  1. package/dist/lib/browser/index.mjs +19 -118
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/browser/translations.mjs +81 -0
  5. package/dist/lib/browser/translations.mjs.map +7 -0
  6. package/dist/types/src/DebugPlugin.d.ts +3 -1
  7. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  8. package/dist/types/src/DebugPlugin.node.d.ts +5 -0
  9. package/dist/types/src/DebugPlugin.node.d.ts.map +1 -0
  10. package/dist/types/src/DebugPlugin.test.d.ts +2 -0
  11. package/dist/types/src/DebugPlugin.test.d.ts.map +1 -0
  12. package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
  13. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  14. package/dist/types/src/capabilities/index.d.ts +11 -4
  15. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  16. package/dist/types/src/capabilities/{react-context/react-context.d.ts → react-context.d.ts} +1 -1
  17. package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
  18. package/dist/types/src/capabilities/react-surface.d.ts +9 -0
  19. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  20. package/dist/types/src/capabilities/settings.d.ts +7 -0
  21. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  22. package/dist/types/src/components/DebugSettings/DebugSettings.d.ts +11 -0
  23. package/dist/types/src/components/DebugSettings/DebugSettings.d.ts.map +1 -0
  24. package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts +97 -0
  25. package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts.map +1 -0
  26. package/dist/types/src/components/DebugSettings/index.d.ts +2 -0
  27. package/dist/types/src/components/DebugSettings/index.d.ts.map +1 -0
  28. package/dist/types/src/components/SchemaTable/SchemaTable.d.ts.map +1 -0
  29. package/dist/types/src/components/SchemaTable/index.d.ts +2 -0
  30. package/dist/types/src/components/SchemaTable/index.d.ts.map +1 -0
  31. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +2 -2
  32. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  33. package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
  34. package/dist/types/src/components/SpaceGenerator/index.d.ts +2 -2
  35. package/dist/types/src/components/SpaceGenerator/index.d.ts.map +1 -1
  36. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  37. package/dist/types/src/components/index.d.ts +4 -10
  38. package/dist/types/src/components/index.d.ts.map +1 -1
  39. package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts +8 -0
  40. package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts.map +1 -0
  41. package/dist/types/src/containers/DebugGraph/index.d.ts +2 -0
  42. package/dist/types/src/containers/DebugGraph/index.d.ts.map +1 -0
  43. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts +6 -0
  44. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -0
  45. package/dist/types/src/containers/DebugObjectPanel/index.d.ts +2 -0
  46. package/dist/types/src/containers/DebugObjectPanel/index.d.ts.map +1 -0
  47. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +5 -0
  48. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -0
  49. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts +2 -0
  50. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts.map +1 -0
  51. package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts.map +1 -0
  52. package/dist/types/src/containers/DebugStatus/index.d.ts +2 -0
  53. package/dist/types/src/containers/DebugStatus/index.d.ts.map +1 -0
  54. package/dist/types/src/{components → containers/DevtoolsOverviewContainer}/DevtoolsOverviewContainer.d.ts +0 -1
  55. package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts.map +1 -0
  56. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts +2 -0
  57. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +1 -0
  58. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts +11 -0
  59. package/dist/types/src/{components → containers}/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
  60. package/dist/types/src/containers/SpaceGenerator/index.d.ts +2 -0
  61. package/dist/types/src/containers/SpaceGenerator/index.d.ts.map +1 -0
  62. package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -0
  63. package/dist/types/src/containers/Wireframe/index.d.ts +2 -0
  64. package/dist/types/src/containers/Wireframe/index.d.ts.map +1 -0
  65. package/dist/types/src/containers/index.d.ts +9 -0
  66. package/dist/types/src/containers/index.d.ts.map +1 -0
  67. package/dist/types/src/index.d.ts +3 -1
  68. package/dist/types/src/index.d.ts.map +1 -1
  69. package/dist/types/src/translations.d.ts +78 -59
  70. package/dist/types/src/translations.d.ts.map +1 -1
  71. package/dist/types/src/types/Settings.d.ts +8 -0
  72. package/dist/types/src/types/Settings.d.ts.map +1 -0
  73. package/dist/types/src/types/index.d.ts +69 -0
  74. package/dist/types/src/types/index.d.ts.map +1 -0
  75. package/dist/types/tsconfig.tsbuildinfo +1 -1
  76. package/package.json +89 -70
  77. package/src/DebugPlugin.node.ts +18 -0
  78. package/src/DebugPlugin.test.ts +29 -0
  79. package/src/DebugPlugin.tsx +20 -11
  80. package/src/capabilities/app-graph-builder.ts +405 -0
  81. package/src/capabilities/index.ts +6 -4
  82. package/src/capabilities/react-context.tsx +25 -0
  83. package/src/capabilities/react-surface.tsx +439 -0
  84. package/src/capabilities/{settings/settings.ts → settings.ts} +7 -6
  85. package/src/components/DebugSettings/DebugSettings.stories.tsx +36 -0
  86. package/src/components/DebugSettings/DebugSettings.tsx +262 -0
  87. package/src/components/DebugSettings/index.ts +5 -0
  88. package/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.tsx +2 -2
  89. package/src/components/SchemaTable/index.ts +5 -0
  90. package/src/components/SpaceGenerator/ObjectGenerator.tsx +14 -15
  91. package/src/components/SpaceGenerator/draw-util.ts +8 -8
  92. package/src/components/SpaceGenerator/index.ts +2 -3
  93. package/src/components/SpaceGenerator/presets.ts +53 -73
  94. package/src/components/index.ts +4 -11
  95. package/src/{components → containers/DebugGraph}/DebugGraph.tsx +3 -4
  96. package/src/containers/DebugGraph/index.ts +5 -0
  97. package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +76 -0
  98. package/src/containers/DebugObjectPanel/index.ts +5 -0
  99. package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +47 -0
  100. package/src/containers/DebugSpaceObjectsPanel/index.ts +5 -0
  101. package/src/{components → containers/DebugStatus}/DebugStatus.tsx +41 -19
  102. package/src/containers/DebugStatus/index.ts +5 -0
  103. package/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx +25 -0
  104. package/src/containers/DevtoolsOverviewContainer/index.ts +5 -0
  105. package/src/containers/SpaceGenerator/SpaceGenerator.tsx +126 -0
  106. package/src/containers/SpaceGenerator/index.ts +5 -0
  107. package/src/{components → containers/Wireframe}/Wireframe.tsx +3 -7
  108. package/src/containers/Wireframe/index.ts +5 -0
  109. package/src/containers/index.ts +13 -0
  110. package/src/index.ts +7 -1
  111. package/src/meta.ts +1 -1
  112. package/src/translations.ts +75 -58
  113. package/src/types/Settings.ts +16 -0
  114. package/src/{types.ts → types/index.ts} +15 -14
  115. package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs +0 -15
  116. package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs.map +0 -7
  117. package/dist/lib/browser/DevtoolsOverviewContainer-77PKFLYV.mjs +0 -19
  118. package/dist/lib/browser/DevtoolsOverviewContainer-77PKFLYV.mjs.map +0 -7
  119. package/dist/lib/browser/SpaceGenerator-H33AEFGC.mjs +0 -1152
  120. package/dist/lib/browser/SpaceGenerator-H33AEFGC.mjs.map +0 -7
  121. package/dist/lib/browser/app-graph-builder-LV73R7HR.mjs +0 -598
  122. package/dist/lib/browser/app-graph-builder-LV73R7HR.mjs.map +0 -7
  123. package/dist/lib/browser/chunk-4UFQXPP7.mjs +0 -78
  124. package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +0 -7
  125. package/dist/lib/browser/chunk-A5H5GRV6.mjs +0 -20
  126. package/dist/lib/browser/chunk-A5H5GRV6.mjs.map +0 -7
  127. package/dist/lib/browser/react-context-FSWBT3MH.mjs +0 -17
  128. package/dist/lib/browser/react-context-FSWBT3MH.mjs.map +0 -7
  129. package/dist/lib/browser/react-surface-2N6CPSHR.mjs +0 -757
  130. package/dist/lib/browser/react-surface-2N6CPSHR.mjs.map +0 -7
  131. package/dist/lib/browser/settings-KA4GN73K.mjs +0 -31
  132. package/dist/lib/browser/settings-KA4GN73K.mjs.map +0 -7
  133. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +0 -6
  134. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
  135. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
  136. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
  137. package/dist/types/src/capabilities/react-context/index.d.ts +0 -7
  138. package/dist/types/src/capabilities/react-context/index.d.ts.map +0 -1
  139. package/dist/types/src/capabilities/react-context/react-context.d.ts.map +0 -1
  140. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  141. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  142. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
  143. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  144. package/dist/types/src/capabilities/settings/index.d.ts +0 -3
  145. package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
  146. package/dist/types/src/capabilities/settings/settings.d.ts +0 -5
  147. package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
  148. package/dist/types/src/components/Container.d.ts +0 -5
  149. package/dist/types/src/components/Container.d.ts.map +0 -1
  150. package/dist/types/src/components/DebugGraph.d.ts +0 -9
  151. package/dist/types/src/components/DebugGraph.d.ts.map +0 -1
  152. package/dist/types/src/components/DebugObjectPanel.d.ts +0 -7
  153. package/dist/types/src/components/DebugObjectPanel.d.ts.map +0 -1
  154. package/dist/types/src/components/DebugSettings.d.ts +0 -8
  155. package/dist/types/src/components/DebugSettings.d.ts.map +0 -1
  156. package/dist/types/src/components/DebugStatus.d.ts.map +0 -1
  157. package/dist/types/src/components/DevtoolsOverviewContainer.d.ts.map +0 -1
  158. package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +0 -1
  159. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +0 -9
  160. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +0 -15
  161. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +0 -1
  162. package/dist/types/src/components/Wireframe.d.ts.map +0 -1
  163. package/dist/types/src/types.d.ts +0 -68
  164. package/dist/types/src/types.d.ts.map +0 -1
  165. package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -420
  166. package/src/capabilities/app-graph-builder/index.ts +0 -7
  167. package/src/capabilities/react-context/index.ts +0 -7
  168. package/src/capabilities/react-context/react-context.tsx +0 -20
  169. package/src/capabilities/react-surface/index.ts +0 -7
  170. package/src/capabilities/react-surface/react-surface.tsx +0 -409
  171. package/src/capabilities/settings/index.ts +0 -7
  172. package/src/components/Container.tsx +0 -15
  173. package/src/components/DebugObjectPanel.tsx +0 -33
  174. package/src/components/DebugSettings.tsx +0 -185
  175. package/src/components/DevtoolsOverviewContainer.tsx +0 -20
  176. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +0 -54
  177. package/src/components/SpaceGenerator/SpaceGenerator.tsx +0 -127
  178. /package/dist/types/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.d.ts +0 -0
  179. /package/dist/types/src/{components → containers/DebugStatus}/DebugStatus.d.ts +0 -0
  180. /package/dist/types/src/{components → containers/Wireframe}/Wireframe.d.ts +0 -0
@@ -1,409 +0,0 @@
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
- );
@@ -1,7 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { Capability } from '@dxos/app-framework';
6
-
7
- export const DebugSettings = Capability.lazy('DebugSettings', () => import('./settings'));
@@ -1,15 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import React, { type PropsWithChildren, type ReactNode } from 'react';
6
-
7
- // TODO(burdon): Convert to grid.
8
- export const Container = ({ toolbar, children }: PropsWithChildren<{ toolbar: ReactNode }>) => {
9
- return (
10
- <div role='none' className='flex flex-col grow overflow-hidden divide-y divide-separator'>
11
- {toolbar}
12
- <div className='flex flex-col grow overflow-auto'>{children}</div>
13
- </div>
14
- );
15
- };
@@ -1,33 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import React from 'react';
6
-
7
- import { type Obj } from '@dxos/echo';
8
- import { Clipboard, Input, Toolbar } from '@dxos/react-ui';
9
- import { Layout } from '@dxos/react-ui-mosaic';
10
- import { Json } from '@dxos/react-ui-syntax-highlighter';
11
-
12
- export type DebugObjectPanelProps = {
13
- object: Obj.Unknown;
14
- };
15
-
16
- // TODO(burdon): Get schema and traverse references.
17
- export const DebugObjectPanel = ({ object }: DebugObjectPanelProps) => {
18
- const dxn = `dxn:echo:@:${object.id}`;
19
-
20
- return (
21
- <Clipboard.Provider>
22
- <Layout.Main toolbar>
23
- <Toolbar.Root>
24
- <Input.Root>
25
- <Input.TextInput disabled value={dxn} />
26
- <Clipboard.IconButton value={dxn} />
27
- </Input.Root>
28
- </Toolbar.Root>
29
- <Json data={object} />
30
- </Layout.Main>
31
- </Clipboard.Provider>
32
- );
33
- };
@@ -1,185 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import React, { useEffect, useState } from 'react';
6
-
7
- import { Common } from '@dxos/app-framework';
8
- import { useCapabilities } from '@dxos/app-framework/react';
9
- import { type ConfigProto, SaveConfig, Storage, defs } from '@dxos/config';
10
- import { log } from '@dxos/log';
11
- import { useClient } from '@dxos/react-client';
12
- import { Icon, IconButton, Input, Select, Toast, useFileDownload, useTranslation } from '@dxos/react-ui';
13
- import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from '@dxos/react-ui-form';
14
- import { setDeep } from '@dxos/util';
15
-
16
- import { meta } from '../meta';
17
- import { type DebugSettingsProps } from '../types';
18
-
19
- type Toast = {
20
- title: string;
21
- description?: string;
22
- };
23
-
24
- const StorageAdapters = {
25
- opfs: defs.Runtime.Client.Storage.StorageDriver.WEBFS,
26
- idb: defs.Runtime.Client.Storage.StorageDriver.IDB,
27
- } as const;
28
-
29
- export type DebugSettingsComponentProps = {
30
- settings: DebugSettingsProps;
31
- onSettingsChange: (fn: (current: DebugSettingsProps) => DebugSettingsProps) => void;
32
- };
33
-
34
- export const DebugSettings = ({ settings, onSettingsChange }: DebugSettingsComponentProps) => {
35
- const { t } = useTranslation(meta.id);
36
- const [toast, setToast] = useState<Toast>();
37
- const client = useClient();
38
- const download = useFileDownload();
39
- // TODO(mykola): Get updates from other places that change Config.
40
- const [storageConfig, setStorageConfig] = useState<ConfigProto>({});
41
- const [upload] = useCapabilities(Common.Capability.FileUploader);
42
-
43
- useEffect(() => {
44
- void Storage().then((config) => setStorageConfig(config));
45
- }, []);
46
-
47
- const handleToast = (toast: Toast) => {
48
- setToast(toast);
49
- const t = setTimeout(() => setToast(undefined), 5_000);
50
- return () => clearTimeout(t);
51
- };
52
-
53
- const handleDownload = async () => {
54
- const data = await client.diagnostics();
55
- const file = new Blob([JSON.stringify(data, undefined, 2)], {
56
- type: 'text/plain',
57
- });
58
- const fileName = `composer-${new Date().toISOString().replace(/\W/g, '-')}.json`;
59
- download(file, fileName);
60
-
61
- if (upload) {
62
- const info = await upload(client.spaces.default.db, new File([file], fileName));
63
- if (!info) {
64
- log.error('diagnostics failed to upload to IPFS');
65
- return;
66
- }
67
- handleToast({
68
- title: t('settings uploaded'),
69
- description: t('settings uploaded to clipboard'),
70
- });
71
-
72
- // TODO(nf): move to IpfsPlugin?
73
- const url = client.config.values.runtime!.services!.ipfs!.gateway + '/' + info.cid;
74
- void navigator.clipboard.writeText(url);
75
- handleToast({
76
- title: t('settings uploaded'),
77
- description: t('settings uploaded to clipboard'),
78
- });
79
- log.info('diagnostics', { url });
80
- }
81
- };
82
-
83
- const handleRepair = async () => {
84
- try {
85
- const info = await client.repair();
86
- setStorageConfig(await Storage());
87
- handleToast({
88
- title: t('settings repair success'),
89
- description: JSON.stringify(info, undefined, 2),
90
- });
91
- } catch (err: any) {
92
- handleToast({
93
- title: t('settings repair failed'),
94
- description: err.message,
95
- });
96
- }
97
- };
98
-
99
- return (
100
- <ControlPage>
101
- <ControlSection title={t('settings title', { ns: meta.id })}>
102
- <ControlGroup>
103
- <ControlItemInput title={t('settings wireframe')}>
104
- <Input.Switch
105
- checked={settings.wireframe}
106
- onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, wireframe: !!checked }))}
107
- />
108
- </ControlItemInput>
109
- <ControlItemInput title={t('settings download diagnostics')}>
110
- <IconButton
111
- icon='ph--download-simple--regular'
112
- iconOnly
113
- label={t('settings download diagnostics')}
114
- onClick={handleDownload}
115
- />
116
- </ControlItemInput>
117
- <ControlItemInput title={t('settings repair')}>
118
- <IconButton
119
- icon='ph--first-aid-kit--regular'
120
- iconOnly
121
- label={t('settings repair')}
122
- onClick={handleRepair}
123
- />
124
- </ControlItemInput>
125
-
126
- {/* TODO(burdon): Move to layout? */}
127
- {toast && (
128
- <Toast.Root>
129
- <Toast.Body>
130
- <Toast.Title>
131
- <Icon icon='ph--gift--duotone' size={5} classNames='inline mr-1' />
132
- <span>{toast.title}</span>
133
- </Toast.Title>
134
- {toast.description && <Toast.Description>{toast.description}</Toast.Description>}
135
- </Toast.Body>
136
- </Toast.Root>
137
- )}
138
-
139
- <ControlItemInput title={t('settings choose storage adaptor')}>
140
- <Select.Root
141
- value={
142
- Object.entries(StorageAdapters).find(
143
- ([_name, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore,
144
- )?.[0]
145
- }
146
- onValueChange={(value) => {
147
- if (confirm(t('settings storage adapter changed alert'))) {
148
- updateConfig(
149
- storageConfig,
150
- setStorageConfig,
151
- ['runtime', 'client', 'storage', 'dataStore'],
152
- StorageAdapters[value as keyof typeof StorageAdapters],
153
- );
154
- }
155
- }}
156
- >
157
- <Select.TriggerButton placeholder={t('settings data store label')} />
158
- <Select.Portal>
159
- <Select.Content>
160
- <Select.Viewport>
161
- {Object.keys(StorageAdapters).map((key) => (
162
- <Select.Option key={key} value={key}>
163
- {t(`settings storage adaptor ${key} label`)}
164
- </Select.Option>
165
- ))}
166
- </Select.Viewport>
167
- <Select.Arrow />
168
- </Select.Content>
169
- </Select.Portal>
170
- </Select.Root>
171
- </ControlItemInput>
172
- </ControlGroup>
173
- </ControlSection>
174
- </ControlPage>
175
- );
176
- };
177
-
178
- const updateConfig = (config: ConfigProto, setConfig: (newConfig: ConfigProto) => void, path: string[], value: any) => {
179
- const storageConfigCopy = JSON.parse(JSON.stringify(config ?? {}));
180
- setDeep(storageConfigCopy, path, value);
181
- setConfig(storageConfigCopy);
182
- queueMicrotask(async () => {
183
- await SaveConfig(storageConfigCopy);
184
- });
185
- };
@@ -1,20 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import React from 'react';
6
-
7
- import { Surface } from '@dxos/app-framework/react';
8
- import { StatsPanel, useStats } from '@dxos/devtools';
9
-
10
- export const DevtoolsOverviewContainer = () => {
11
- const [stats, refreshStats] = useStats();
12
-
13
- return (
14
- <StatsPanel stats={stats} onRefresh={refreshStats}>
15
- <Surface role='devtools-overview' />
16
- </StatsPanel>
17
- );
18
- };
19
-
20
- export default DevtoolsOverviewContainer;