@dxos/plugin-debug 0.8.3 → 0.8.4-main.1c7ec43d41

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 (169) hide show
  1. package/dist/lib/browser/index.mjs +19 -123
  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 +4 -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 +4 -2
  13. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  14. package/dist/types/src/capabilities/index.d.ts +8 -5
  15. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  16. package/dist/types/src/capabilities/react-context.d.ts +4 -2
  17. package/dist/types/src/capabilities/react-context.d.ts.map +1 -1
  18. package/dist/types/src/capabilities/react-surface.d.ts +7 -2
  19. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  20. package/dist/types/src/capabilities/settings.d.ts +5 -2
  21. package/dist/types/src/capabilities/settings.d.ts.map +1 -1
  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 +99 -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 +6 -4
  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 +5 -8
  37. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  38. package/dist/types/src/components/index.d.ts +4 -9
  39. package/dist/types/src/components/index.d.ts.map +1 -1
  40. package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts +8 -0
  41. package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts.map +1 -0
  42. package/dist/types/src/containers/DebugGraph/index.d.ts +2 -0
  43. package/dist/types/src/containers/DebugGraph/index.d.ts.map +1 -0
  44. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts +6 -0
  45. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -0
  46. package/dist/types/src/containers/DebugObjectPanel/index.d.ts +2 -0
  47. package/dist/types/src/containers/DebugObjectPanel/index.d.ts.map +1 -0
  48. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +5 -0
  49. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -0
  50. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts +2 -0
  51. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts.map +1 -0
  52. package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts.map +1 -0
  53. package/dist/types/src/containers/DebugStatus/index.d.ts +2 -0
  54. package/dist/types/src/containers/DebugStatus/index.d.ts.map +1 -0
  55. package/dist/types/src/{components → containers/DevtoolsOverviewContainer}/DevtoolsOverviewContainer.d.ts +0 -1
  56. package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts.map +1 -0
  57. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts +2 -0
  58. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +1 -0
  59. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts +11 -0
  60. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts.map +1 -0
  61. package/dist/types/src/containers/SpaceGenerator/index.d.ts +2 -0
  62. package/dist/types/src/containers/SpaceGenerator/index.d.ts.map +1 -0
  63. package/dist/types/src/{components → containers/Wireframe}/Wireframe.d.ts +2 -2
  64. package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -0
  65. package/dist/types/src/containers/Wireframe/index.d.ts +2 -0
  66. package/dist/types/src/containers/Wireframe/index.d.ts.map +1 -0
  67. package/dist/types/src/containers/index.d.ts +9 -0
  68. package/dist/types/src/containers/index.d.ts.map +1 -0
  69. package/dist/types/src/index.d.ts +3 -1
  70. package/dist/types/src/index.d.ts.map +1 -1
  71. package/dist/types/src/meta.d.ts +2 -3
  72. package/dist/types/src/meta.d.ts.map +1 -1
  73. package/dist/types/src/translations.d.ts +83 -60
  74. package/dist/types/src/translations.d.ts.map +1 -1
  75. package/dist/types/src/types/Settings.d.ts +8 -0
  76. package/dist/types/src/types/Settings.d.ts.map +1 -0
  77. package/dist/types/src/types/index.d.ts +69 -0
  78. package/dist/types/src/types/index.d.ts.map +1 -0
  79. package/dist/types/tsconfig.tsbuildinfo +1 -1
  80. package/package.json +99 -73
  81. package/src/DebugPlugin.node.ts +18 -0
  82. package/src/DebugPlugin.test.ts +29 -0
  83. package/src/DebugPlugin.tsx +30 -37
  84. package/src/capabilities/app-graph-builder.ts +361 -413
  85. package/src/capabilities/index.ts +5 -5
  86. package/src/capabilities/react-context.tsx +16 -7
  87. package/src/capabilities/react-surface.tsx +381 -339
  88. package/src/capabilities/settings.ts +24 -12
  89. package/src/components/DebugSettings/DebugSettings.stories.tsx +36 -0
  90. package/src/components/DebugSettings/DebugSettings.tsx +262 -0
  91. package/src/components/DebugSettings/index.ts +5 -0
  92. package/src/components/SchemaTable/index.ts +5 -0
  93. package/src/components/SpaceGenerator/ObjectGenerator.tsx +44 -46
  94. package/src/components/SpaceGenerator/draw-util.ts +13 -13
  95. package/src/components/SpaceGenerator/index.ts +2 -3
  96. package/src/components/SpaceGenerator/presets.ts +527 -263
  97. package/src/components/index.ts +4 -8
  98. package/src/containers/DebugGraph/DebugGraph.tsx +14 -0
  99. package/src/containers/DebugGraph/index.ts +5 -0
  100. package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +76 -0
  101. package/src/containers/DebugObjectPanel/index.ts +5 -0
  102. package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +47 -0
  103. package/src/containers/DebugSpaceObjectsPanel/index.ts +5 -0
  104. package/src/{components → containers/DebugStatus}/DebugStatus.tsx +43 -21
  105. package/src/containers/DebugStatus/index.ts +5 -0
  106. package/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx +25 -0
  107. package/src/containers/DevtoolsOverviewContainer/index.ts +5 -0
  108. package/src/containers/SpaceGenerator/SpaceGenerator.tsx +126 -0
  109. package/src/containers/SpaceGenerator/index.ts +5 -0
  110. package/src/{components → containers/Wireframe}/Wireframe.tsx +8 -12
  111. package/src/containers/Wireframe/index.ts +5 -0
  112. package/src/containers/index.ts +13 -0
  113. package/src/index.ts +7 -1
  114. package/src/meta.ts +8 -7
  115. package/src/translations.ts +80 -59
  116. package/src/types/Settings.ts +16 -0
  117. package/src/{types.ts → types/index.ts} +20 -11
  118. package/dist/lib/browser/DebugApp-WSEJPCKY.mjs +0 -225
  119. package/dist/lib/browser/DebugApp-WSEJPCKY.mjs.map +0 -7
  120. package/dist/lib/browser/DevtoolsOverviewContainer-IIIWO77Q.mjs +0 -25
  121. package/dist/lib/browser/DevtoolsOverviewContainer-IIIWO77Q.mjs.map +0 -7
  122. package/dist/lib/browser/SpaceGenerator-VB6IB2LL.mjs +0 -1238
  123. package/dist/lib/browser/SpaceGenerator-VB6IB2LL.mjs.map +0 -7
  124. package/dist/lib/browser/app-graph-builder-6HHJMKVU.mjs +0 -597
  125. package/dist/lib/browser/app-graph-builder-6HHJMKVU.mjs.map +0 -7
  126. package/dist/lib/browser/chunk-47JOZTT2.mjs +0 -18
  127. package/dist/lib/browser/chunk-47JOZTT2.mjs.map +0 -7
  128. package/dist/lib/browser/chunk-KS3YBEL7.mjs +0 -68
  129. package/dist/lib/browser/chunk-KS3YBEL7.mjs.map +0 -7
  130. package/dist/lib/browser/react-context-ZQRD2WG2.mjs +0 -16
  131. package/dist/lib/browser/react-context-ZQRD2WG2.mjs.map +0 -7
  132. package/dist/lib/browser/react-surface-UI6OK73H.mjs +0 -768
  133. package/dist/lib/browser/react-surface-UI6OK73H.mjs.map +0 -7
  134. package/dist/lib/browser/settings-SXQWSIM4.mjs +0 -22
  135. package/dist/lib/browser/settings-SXQWSIM4.mjs.map +0 -7
  136. package/dist/types/src/components/Container.d.ts +0 -5
  137. package/dist/types/src/components/Container.d.ts.map +0 -1
  138. package/dist/types/src/components/DebugApp/DebugApp.d.ts +0 -6
  139. package/dist/types/src/components/DebugApp/DebugApp.d.ts.map +0 -1
  140. package/dist/types/src/components/DebugApp/Tree.d.ts +0 -18
  141. package/dist/types/src/components/DebugApp/Tree.d.ts.map +0 -1
  142. package/dist/types/src/components/DebugApp/index.d.ts +0 -3
  143. package/dist/types/src/components/DebugApp/index.d.ts.map +0 -1
  144. package/dist/types/src/components/DebugObjectPanel.d.ts +0 -7
  145. package/dist/types/src/components/DebugObjectPanel.d.ts.map +0 -1
  146. package/dist/types/src/components/DebugSettings.d.ts +0 -6
  147. package/dist/types/src/components/DebugSettings.d.ts.map +0 -1
  148. package/dist/types/src/components/DebugStatus.d.ts.map +0 -1
  149. package/dist/types/src/components/DevtoolsOverviewContainer.d.ts.map +0 -1
  150. package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +0 -1
  151. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +0 -9
  152. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +0 -1
  153. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +0 -6
  154. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +0 -1
  155. package/dist/types/src/components/Wireframe.d.ts.map +0 -1
  156. package/dist/types/src/types.d.ts +0 -63
  157. package/dist/types/src/types.d.ts.map +0 -1
  158. package/src/components/Container.tsx +0 -15
  159. package/src/components/DebugApp/DebugApp.tsx +0 -77
  160. package/src/components/DebugApp/Tree.tsx +0 -103
  161. package/src/components/DebugApp/index.ts +0 -7
  162. package/src/components/DebugObjectPanel.tsx +0 -35
  163. package/src/components/DebugSettings.tsx +0 -151
  164. package/src/components/DevtoolsOverviewContainer.tsx +0 -20
  165. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +0 -52
  166. package/src/components/SpaceGenerator/SpaceGenerator.tsx +0 -179
  167. /package/dist/types/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.d.ts +0 -0
  168. /package/dist/types/src/{components → containers/DebugStatus}/DebugStatus.d.ts +0 -0
  169. /package/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.tsx +0 -0
@@ -2,20 +2,13 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { pipe } from 'effect';
5
+ import * as Effect from 'effect/Effect';
6
6
  import React, { useCallback } from 'react';
7
7
 
8
- import {
9
- Capabilities,
10
- chain,
11
- contributes,
12
- createIntent,
13
- createSurface,
14
- LayoutAction,
15
- useCapability,
16
- useIntentDispatcher,
17
- type PluginContext,
18
- } from '@dxos/app-framework';
8
+ import { Capabilities, Capability } from '@dxos/app-framework';
9
+ import { Surface, useOperationInvoker, useSettingsState } from '@dxos/app-framework/ui';
10
+ import { AppCapabilities, LayoutOperation, getObjectPathFromObject } from '@dxos/app-toolkit';
11
+ import { AppSurface, useActiveSpace } from '@dxos/app-toolkit/ui';
19
12
  import {
20
13
  AutomergePanel,
21
14
  ConfigPanel,
@@ -40,31 +33,33 @@ import {
40
33
  StoragePanel,
41
34
  SwarmPanel,
42
35
  TestingPanel,
43
- TracingPanel,
44
36
  WorkflowPanel,
45
37
  } from '@dxos/devtools';
46
- import { Obj, Type } from '@dxos/echo';
47
- import { SettingsStore } from '@dxos/local-storage';
38
+ import { Feed, Obj } from '@dxos/echo';
39
+ import { Collection } from '@dxos/echo';
48
40
  import { log } from '@dxos/log';
49
- import { ClientCapabilities } from '@dxos/plugin-client';
50
- import { Graph } from '@dxos/plugin-graph';
51
- import { ScriptAction } from '@dxos/plugin-script/types';
52
- import { SpaceAction } from '@dxos/plugin-space/types';
53
- import { SpaceState, isSpace, type Space, parseId } from '@dxos/react-client/echo';
54
- import { StackItem } from '@dxos/react-ui-stack';
55
- import { DataType } from '@dxos/schema';
41
+ import { type IdbLogStore } from '@dxos/log-store-idb';
42
+ import { type Graph } from '@dxos/plugin-graph';
43
+ import { ScriptOperation } from '@dxos/plugin-script/operations';
44
+ import { SpaceOperation } from '@dxos/plugin-space/operations';
45
+ import { type Space, SpaceState, isSpace } from '@dxos/react-client/echo';
46
+ import { ToolsExplorer } from '@dxos/react-ui-introspect';
56
47
 
48
+ import { DebugSettings } from '#components';
57
49
  import {
58
- DebugApp,
50
+ DebugGraph,
59
51
  DebugObjectPanel,
60
- DebugSettings,
52
+ DebugSpaceObjectsPanel,
61
53
  DebugStatus,
62
54
  DevtoolsOverviewContainer,
63
55
  SpaceGenerator,
64
56
  Wireframe,
65
- } from '../components';
66
- import { DEBUG_PLUGIN } from '../meta';
67
- import { type DebugSettingsProps, Devtools } from '../types';
57
+ } from '#containers';
58
+ import { meta } from '#meta';
59
+ import { DebugCapabilities, type Settings, Devtools } from '#types';
60
+
61
+ // TODO(burdon): Move to config.
62
+ const MCP_SERVER_URL = 'https://introspect-service-labs.dxos.workers.dev/mcp';
68
63
 
69
64
  type SpaceDebug = {
70
65
  type: string;
@@ -72,326 +67,373 @@ type SpaceDebug = {
72
67
  };
73
68
 
74
69
  type GraphDebug = {
75
- graph: Graph;
70
+ graph: Graph.Graph;
71
+ root: string;
76
72
  };
77
73
 
78
- const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${DEBUG_PLUGIN}/space` && isSpace(data.space);
79
- const isGraphDebug = (data: any): data is GraphDebug => data?.graph instanceof Graph;
74
+ const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${meta.id}.space` && isSpace(data.space);
75
+ const isGraphDebug = (data: any): data is GraphDebug => {
76
+ const graph = data?.graph;
77
+ return (
78
+ graph != null && typeof graph === 'object' && typeof graph.json === 'function' && typeof data?.root === 'string'
79
+ );
80
+ };
80
81
 
81
- // TODO(wittjosiah): Factor out?
82
- const useCurrentSpace = () => {
83
- const layout = useCapability(Capabilities.Layout);
84
- const client = useCapability(ClientCapabilities.Client);
85
- const { spaceId } = parseId(layout.workspace);
86
- const space = spaceId ? client.spaces.get(spaceId) : undefined;
87
- return space;
82
+ type ReactSurfaceOptions = {
83
+ logStore?: IdbLogStore;
88
84
  };
89
85
 
90
- export default (context: PluginContext) =>
91
- contributes(Capabilities.ReactSurface, [
92
- createSurface({
93
- id: `${DEBUG_PLUGIN}/plugin-settings`,
94
- role: 'article',
95
- filter: (data): data is { subject: SettingsStore<DebugSettingsProps> } =>
96
- data.subject instanceof SettingsStore && data.subject.prefix === DEBUG_PLUGIN,
97
- component: ({ data: { subject } }) => <DebugSettings settings={subject.value} />,
98
- }),
99
- createSurface({
100
- id: `${DEBUG_PLUGIN}/space`,
101
- role: 'article',
102
- filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),
103
- component: ({ data }) => {
104
- const { dispatchPromise: dispatch } = useIntentDispatcher();
86
+ export default Capability.makeModule(
87
+ Effect.fnUntraced(function* ({ logStore }: ReactSurfaceOptions) {
88
+ const capabilities = yield* Capability.Service;
89
+ const registry = capabilities.get(Capabilities.AtomRegistry);
90
+ const settingsAtom = capabilities.get(DebugCapabilities.Settings);
91
+ const fileUploader = capabilities.getAll(AppCapabilities.FileUploader)[0];
92
+
93
+ return Capability.contributes(Capabilities.ReactSurface, [
94
+ Surface.create({
95
+ id: 'plugin-settings',
96
+ filter: AppSurface.settings(AppSurface.Article, meta.id),
97
+ component: ({ data: { subject } }) => {
98
+ const { settings, updateSettings } = useSettingsState<Settings.Settings>(subject.atom);
99
+ return (
100
+ <DebugSettings
101
+ settings={settings}
102
+ onSettingsChange={updateSettings}
103
+ logStore={logStore}
104
+ onUpload={fileUploader}
105
+ />
106
+ );
107
+ },
108
+ }),
109
+ Surface.create({
110
+ id: 'space',
111
+ role: 'article',
112
+ filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),
113
+ component: ({ role, data }) => {
114
+ const { invokePromise } = useOperationInvoker();
115
+
116
+ const handleCreateObject = useCallback(
117
+ (objects: Obj.Unknown[]) => {
118
+ if (!isSpace(data.subject.space)) {
119
+ return;
120
+ }
121
+
122
+ const collection =
123
+ data.subject.space.state.get() === SpaceState.SPACE_READY &&
124
+ data.subject.space.properties[Collection.Collection.typename]?.target;
125
+ if (!Obj.instanceOf(Collection.Collection, collection)) {
126
+ return;
127
+ }
128
+
129
+ objects.forEach((object) => {
130
+ void invokePromise(SpaceOperation.AddObject, {
131
+ target: collection,
132
+ object,
133
+ });
134
+ });
135
+ },
136
+ [data.subject.space, invokePromise],
137
+ );
138
+
139
+ return <SpaceGenerator role={role} space={data.subject.space} onCreateObjects={handleCreateObject} />;
140
+ },
141
+ }),
142
+ Surface.create({
143
+ 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: 'tools-explorer',
150
+ filter: AppSurface.literal(AppSurface.Article, Devtools.ToolsExplorer),
151
+ component: () => <ToolsExplorer serverUrl={MCP_SERVER_URL} />,
152
+ }),
153
+ Surface.create({
154
+ id: 'wireframe',
155
+ // TODO(wittjosiah): Split into multiple surfaces if this filter proves too strict for non-article roles.
156
+ role: ['article', 'section'],
157
+ position: 'hoist',
158
+ filter: (data): data is { subject: Obj.Unknown } => {
159
+ const settings = registry.get(settingsAtom);
160
+ return Obj.isObject(data.subject) && !!settings.wireframe;
161
+ },
162
+ component: ({ data, role, name }) => (
163
+ <Wireframe label={`${role}:${name}`} object={data.subject} classNames='row-span-2 overflow-hidden' />
164
+ ),
165
+ }),
166
+ Surface.create({
167
+ id: 'object-debug',
168
+ filter: AppSurface.allOf(
169
+ AppSurface.literal(AppSurface.Article, 'debug'),
170
+ AppSurface.companion(AppSurface.Article),
171
+ ),
172
+ component: ({ role, data }) => <DebugObjectPanel role={role} companionTo={data.companionTo} />,
173
+ }),
174
+ Surface.create({
175
+ id: 'devtools-overview',
176
+ filter: AppSurface.literal(Surface.makeType<{ subject: string }>('deck-companion--devtools'), 'devtools'),
177
+ component: () => <DevtoolsOverviewContainer />,
178
+ }),
179
+ Surface.create({
180
+ id: 'space-objects',
181
+ filter: AppSurface.literal(
182
+ Surface.makeType<{ subject: string }>('deck-companion--space-objects'),
183
+ 'space-objects',
184
+ ),
185
+ component: () => {
186
+ const space = useActiveSpace();
187
+ if (!space) {
188
+ return null;
189
+ }
190
+
191
+ return <DebugSpaceObjectsPanel space={space} />;
192
+ },
193
+ }),
194
+
195
+ Surface.create({
196
+ id: 'status',
197
+ role: 'status-indicator',
198
+ position: 'hoist',
199
+ component: () => <DebugStatus />,
200
+ }),
201
+
202
+ //
203
+ // Devtools
204
+ //
205
+
206
+ Surface.create({
207
+ id: 'client.config',
208
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Client.Config),
209
+ component: () => <ConfigPanel vaultSelector={false} />,
210
+ }),
211
+ Surface.create({
212
+ id: 'client.storage',
213
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Client.Storage),
214
+ component: () => <StoragePanel />,
215
+ }),
216
+ Surface.create({
217
+ id: 'client.logs',
218
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Client.Logs),
219
+ component: () => <LoggingPanel />,
220
+ }),
221
+ Surface.create({
222
+ id: 'client.diagnostics',
223
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Client.Diagnostics),
224
+ component: () => <DiagnosticsPanel />,
225
+ }),
226
+ Surface.create({
227
+ id: 'halo.identity',
228
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Halo.Identity),
229
+ component: () => <IdentityPanel />,
230
+ }),
231
+ Surface.create({
232
+ id: 'halo.devices',
233
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Halo.Devices),
234
+ component: () => <DeviceListPanel />,
235
+ }),
236
+ Surface.create({
237
+ id: 'halo.keyring',
238
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Halo.Keyring),
239
+ component: () => <KeyringPanel />,
240
+ }),
241
+ Surface.create({
242
+ id: 'halo.credentials',
243
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Halo.Credentials),
244
+ component: () => {
245
+ const space = useActiveSpace();
246
+ if (!space) {
247
+ return null;
248
+ }
249
+
250
+ return <CredentialsPanel space={space} />;
251
+ },
252
+ }),
253
+ Surface.create({
254
+ id: 'echo.spaces',
255
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Echo.Spaces),
256
+ component: () => {
257
+ const { invokePromise } = useOperationInvoker();
258
+ const handleSelect = useCallback(
259
+ () => invokePromise(LayoutOperation.Open, { subject: [Devtools.Echo.Space] }),
260
+ [invokePromise],
261
+ );
262
+ return <SpaceListPanel onSelect={handleSelect} />;
263
+ },
264
+ }),
265
+ Surface.create({
266
+ id: 'echo.space',
267
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Echo.Space),
268
+ component: () => {
269
+ const space = useActiveSpace();
270
+ const { invokePromise } = useOperationInvoker();
271
+ const handleSelect = useCallback(
272
+ () => invokePromise(LayoutOperation.Open, { subject: [Devtools.Echo.Feeds] }),
273
+ [invokePromise],
274
+ );
275
+ if (!space) {
276
+ return null;
277
+ }
278
+
279
+ return <SpaceInfoPanel space={space} onSelectFeed={handleSelect} onSelectPipeline={handleSelect} />;
280
+ },
281
+ }),
282
+ Surface.create({
283
+ id: 'echo.feeds',
284
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Echo.Feeds),
285
+ component: () => {
286
+ const space = useActiveSpace();
287
+ if (!space) {
288
+ return null;
289
+ }
290
+
291
+ return <FeedsPanel space={space} />;
292
+ },
293
+ }),
294
+ Surface.create({
295
+ id: 'echo.objects',
296
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Echo.Objects),
297
+ component: () => {
298
+ const space = useActiveSpace();
299
+ if (!space) {
300
+ return null;
301
+ }
302
+
303
+ return <ObjectsPanel space={space} />;
304
+ },
305
+ }),
306
+ Surface.create({
307
+ id: 'echo.schema',
308
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Echo.Schema),
309
+ component: () => {
310
+ const space = useActiveSpace();
311
+ if (!space) {
312
+ return null;
313
+ }
105
314
 
106
- const handleCreateObject = useCallback(
107
- (objects: Obj.Any[]) => {
108
- if (!isSpace(data.subject.space)) {
109
- return;
110
- }
315
+ return <SchemaPanel space={space} />;
316
+ },
317
+ }),
318
+ Surface.create({
319
+ id: 'echo.automerge',
320
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Echo.Automerge),
321
+ component: () => {
322
+ const space = useActiveSpace();
323
+ if (!space) {
324
+ return null;
325
+ }
111
326
 
112
- const collection =
113
- data.subject.space.state.get() === SpaceState.SPACE_READY &&
114
- data.subject.space.properties[Type.getTypename(DataType.Collection)]?.target;
115
- if (!Obj.instanceOf(DataType.Collection, collection)) {
116
- return;
117
- }
327
+ return <AutomergePanel space={space} />;
328
+ },
329
+ }),
330
+ Surface.create({
331
+ id: 'echo.queues',
332
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Echo.Queues),
333
+ component: () => <QueuesPanel />,
334
+ }),
335
+ Surface.create({
336
+ id: 'echo.members',
337
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Echo.Members),
338
+ component: () => {
339
+ const space = useActiveSpace();
340
+ if (!space) {
341
+ return null;
342
+ }
118
343
 
119
- objects.forEach((object) => {
120
- void dispatch(createIntent(SpaceAction.AddObject, { target: collection, object }));
121
- });
122
- },
123
- [data.subject.space],
124
- );
344
+ return <MembersPanel space={space} />;
345
+ },
346
+ }),
347
+ Surface.create({
348
+ id: 'echo.metadata',
349
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Echo.Metadata),
350
+ component: () => <MetadataPanel />,
351
+ }),
352
+ Surface.create({
353
+ id: 'mesh.signal',
354
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Mesh.Signal),
355
+ component: () => <SignalPanel />,
356
+ }),
357
+ Surface.create({
358
+ id: 'mesh.swarm',
359
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Mesh.Swarm),
360
+ component: () => <SwarmPanel />,
361
+ }),
362
+ Surface.create({
363
+ id: 'mesh.network',
364
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Mesh.Network),
365
+ component: () => {
366
+ const space = useActiveSpace();
367
+ if (!space) {
368
+ return null;
369
+ }
125
370
 
126
- return (
127
- <StackItem.Content>
128
- <SpaceGenerator space={data.subject.space} onCreateObjects={handleCreateObject} />
129
- </StackItem.Content>
130
- );
131
- },
132
- }),
133
- createSurface({
134
- id: `${DEBUG_PLUGIN}/graph`,
135
- role: 'article',
136
- filter: (data): data is { subject: GraphDebug } => isGraphDebug(data.subject),
137
- component: ({ data }) => <DebugApp graph={data.subject.graph} />,
138
- }),
139
- createSurface({
140
- id: `${DEBUG_PLUGIN}/wireframe`,
141
- role: ['article', 'section'],
142
- position: 'hoist',
143
- filter: (data): data is { subject: Obj.Any } => {
144
- const settings = context
145
- .getCapability(Capabilities.SettingsStore)
146
- .getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;
147
- return Obj.isObject(data.subject) && !!settings.wireframe;
148
- },
149
- component: ({ data, role }) => (
150
- <Wireframe label={`${role}:${name}`} object={data.subject} classNames='row-span-2 overflow-hidden' />
151
- ),
152
- }),
153
- createSurface({
154
- id: `${DEBUG_PLUGIN}/object-debug`,
155
- role: 'article',
156
- filter: (data): data is { companionTo: Obj.Any } => data.subject === 'debug' && Obj.isObject(data.companionTo),
157
- component: ({ data }) => <DebugObjectPanel object={data.companionTo} />,
158
- }),
159
- createSurface({
160
- id: `${DEBUG_PLUGIN}/devtools-overview`,
161
- role: 'deck-companion--devtools',
162
- component: () => <DevtoolsOverviewContainer />,
163
- }),
164
- createSurface({
165
- id: `${DEBUG_PLUGIN}/status`,
166
- role: 'status',
167
- component: () => <DebugStatus />,
168
- }),
371
+ return <NetworkPanel space={space} />;
372
+ },
373
+ }),
374
+ Surface.create({
375
+ id: 'edge.dashboard',
376
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Edge.Dashboard),
377
+ component: () => <EdgeDashboardPanel />,
378
+ }),
379
+ Surface.create({
380
+ id: 'edge.workflows',
381
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Edge.Workflows),
382
+ component: () => {
383
+ const space = useActiveSpace();
384
+ if (!space) {
385
+ return null;
386
+ }
169
387
 
170
- //
171
- // Devtools
172
- //
388
+ return <WorkflowPanel space={space} />;
389
+ },
390
+ }),
391
+ Surface.create({
392
+ id: 'edge.traces',
393
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Edge.Traces),
394
+ component: () => {
395
+ const space = useActiveSpace();
396
+ if (!space) {
397
+ return null;
398
+ }
173
399
 
174
- createSurface({
175
- id: `${DEBUG_PLUGIN}/client/config`,
176
- role: 'article',
177
- filter: (data): data is any => data.subject === Devtools.Client.Config,
178
- component: () => <ConfigPanel vaultSelector={false} />,
179
- }),
180
- createSurface({
181
- id: `${DEBUG_PLUGIN}/client/storage`,
182
- role: 'article',
183
- filter: (data): data is any => data.subject === Devtools.Client.Storage,
184
- component: () => <StoragePanel />,
185
- }),
186
- createSurface({
187
- id: `${DEBUG_PLUGIN}/client/logs`,
188
- role: 'article',
189
- filter: (data): data is any => data.subject === Devtools.Client.Logs,
190
- component: () => <LoggingPanel />,
191
- }),
192
- createSurface({
193
- id: `${DEBUG_PLUGIN}/client/diagnostics`,
194
- role: 'article',
195
- filter: (data): data is any => data.subject === Devtools.Client.Diagnostics,
196
- component: () => <DiagnosticsPanel />,
197
- }),
198
- createSurface({
199
- id: `${DEBUG_PLUGIN}/client/tracing`,
200
- role: 'article',
201
- filter: (data): data is any => data.subject === Devtools.Client.Tracing,
202
- component: () => <TracingPanel />,
203
- }),
204
- createSurface({
205
- id: `${DEBUG_PLUGIN}/halo/identity`,
206
- role: 'article',
207
- filter: (data): data is any => data.subject === Devtools.Halo.Identity,
208
- component: () => <IdentityPanel />,
209
- }),
210
- createSurface({
211
- id: `${DEBUG_PLUGIN}/halo/devices`,
212
- role: 'article',
213
- filter: (data): data is any => data.subject === Devtools.Halo.Devices,
214
- component: () => <DeviceListPanel />,
215
- }),
216
- createSurface({
217
- id: `${DEBUG_PLUGIN}/halo/keyring`,
218
- role: 'article',
219
- filter: (data): data is any => data.subject === Devtools.Halo.Keyring,
220
- component: () => <KeyringPanel />,
221
- }),
222
- createSurface({
223
- id: `${DEBUG_PLUGIN}/halo/credentials`,
224
- role: 'article',
225
- filter: (data): data is any => data.subject === Devtools.Halo.Credentials,
226
- component: () => {
227
- const space = useCurrentSpace();
228
- return <CredentialsPanel space={space} />;
229
- },
230
- }),
231
- createSurface({
232
- id: `${DEBUG_PLUGIN}/echo/spaces`,
233
- role: 'article',
234
- filter: (data): data is any => data.subject === Devtools.Echo.Spaces,
235
- component: () => {
236
- const { dispatchPromise: dispatch } = useIntentDispatcher();
237
- const handleSelect = useCallback(
238
- () => dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [Devtools.Echo.Space] })),
239
- [dispatch],
240
- );
241
- return <SpaceListPanel onSelect={handleSelect} />;
242
- },
243
- }),
244
- createSurface({
245
- id: `${DEBUG_PLUGIN}/echo/space`,
246
- role: 'article',
247
- filter: (data): data is any => data.subject === Devtools.Echo.Space,
248
- component: () => {
249
- const space = useCurrentSpace();
250
- const { dispatchPromise: dispatch } = useIntentDispatcher();
251
- const handleSelect = useCallback(
252
- () => dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [Devtools.Echo.Feeds] })),
253
- [dispatch],
254
- );
255
- return <SpaceInfoPanel space={space} onSelectFeed={handleSelect} onSelectPipeline={handleSelect} />;
256
- },
257
- }),
258
- createSurface({
259
- id: `${DEBUG_PLUGIN}/echo/feeds`,
260
- role: 'article',
261
- filter: (data): data is any => data.subject === Devtools.Echo.Feeds,
262
- component: () => {
263
- const space = useCurrentSpace();
264
- return <FeedsPanel space={space} />;
265
- },
266
- }),
267
- createSurface({
268
- id: `${DEBUG_PLUGIN}/echo/objects`,
269
- role: 'article',
270
- filter: (data): data is any => data.subject === Devtools.Echo.Objects,
271
- component: () => {
272
- const space = useCurrentSpace();
273
- return <ObjectsPanel space={space} />;
274
- },
275
- }),
276
- createSurface({
277
- id: `${DEBUG_PLUGIN}/echo/schema`,
278
- role: 'article',
279
- filter: (data): data is any => data.subject === Devtools.Echo.Schema,
280
- component: () => {
281
- const space = useCurrentSpace();
282
- return <SchemaPanel space={space} />;
283
- },
284
- }),
285
- createSurface({
286
- id: `${DEBUG_PLUGIN}/echo/automerge`,
287
- role: 'article',
288
- filter: (data): data is any => data.subject === Devtools.Echo.Automerge,
289
- component: () => {
290
- const space = useCurrentSpace();
291
- return <AutomergePanel space={space} />;
292
- },
293
- }),
294
- createSurface({
295
- id: `${DEBUG_PLUGIN}/echo/queues`,
296
- role: 'article',
297
- filter: (data): data is any => data.subject === Devtools.Echo.Queues,
298
- component: () => <QueuesPanel />,
299
- }),
300
- createSurface({
301
- id: `${DEBUG_PLUGIN}/echo/members`,
302
- role: 'article',
303
- filter: (data): data is any => data.subject === Devtools.Echo.Members,
304
- component: () => {
305
- const space = useCurrentSpace();
306
- return <MembersPanel space={space} />;
307
- },
308
- }),
309
- createSurface({
310
- id: `${DEBUG_PLUGIN}/echo/metadata`,
311
- role: 'article',
312
- filter: (data): data is any => data.subject === Devtools.Echo.Metadata,
313
- component: () => <MetadataPanel />,
314
- }),
315
- createSurface({
316
- id: `${DEBUG_PLUGIN}/mesh/signal`,
317
- role: 'article',
318
- filter: (data): data is any => data.subject === Devtools.Mesh.Signal,
319
- component: () => <SignalPanel />,
320
- }),
321
- createSurface({
322
- id: `${DEBUG_PLUGIN}/mesh/swarm`,
323
- role: 'article',
324
- filter: (data): data is any => data.subject === Devtools.Mesh.Swarm,
325
- component: () => <SwarmPanel />,
326
- }),
327
- createSurface({
328
- id: `${DEBUG_PLUGIN}/mesh/network`,
329
- role: 'article',
330
- filter: (data): data is any => data.subject === Devtools.Mesh.Network,
331
- component: () => {
332
- const space = useCurrentSpace();
333
- return <NetworkPanel space={space} />;
334
- },
335
- }),
336
- // TODO(wittjosiah): Remove?
337
- // createSurface({
338
- // id: `${DEBUG_PLUGIN}/agent/dashboard`,
339
- // role: 'article',
340
- // filter: (data): data is any => data.subject === Devtools.Agent.Dashboard,
341
- // component: () => <DashboardPanel />,
342
- // }),
343
- createSurface({
344
- id: `${DEBUG_PLUGIN}/edge/dashboard`,
345
- role: 'article',
346
- filter: (data): data is any => data.subject === Devtools.Edge.Dashboard,
347
- component: () => <EdgeDashboardPanel />,
348
- }),
349
- createSurface({
350
- id: `${DEBUG_PLUGIN}/edge/workflows`,
351
- role: 'article',
352
- filter: (data): data is any => data.subject === Devtools.Edge.Workflows,
353
- component: () => {
354
- const space = useCurrentSpace();
355
- return <WorkflowPanel space={space} />;
356
- },
357
- }),
358
- createSurface({
359
- id: `${DEBUG_PLUGIN}/edge/traces`,
360
- role: 'article',
361
- filter: (data): data is any => data.subject === Devtools.Edge.Traces,
362
- component: () => {
363
- const space = useCurrentSpace();
364
- return <InvocationTraceContainer space={space} detailAxis='block' />;
365
- },
366
- }),
367
- createSurface({
368
- id: `${DEBUG_PLUGIN}/edge/testing`,
369
- role: 'article',
370
- filter: (data): data is any => data.subject === Devtools.Edge.Testing,
371
- component: () => {
372
- const { dispatchPromise: dispatch } = useIntentDispatcher();
373
- const onSpaceCreate = useCallback(
374
- async (space: Space) => {
375
- await space.waitUntilReady();
376
- await dispatch(createIntent(SpaceAction.Migrate, { space }));
377
- await space.db.flush();
378
- },
379
- [dispatch],
380
- );
381
- const onScriptPluginOpen = useCallback(
382
- async (space: Space) => {
383
- await space.waitUntilReady();
384
- const result = await dispatch(
385
- pipe(createIntent(ScriptAction.Create, { space }), chain(SpaceAction.AddObject, { target: space })),
386
- );
387
- log.info('script created', { result });
388
- await dispatch(
389
- createIntent(LayoutAction.Open, { part: 'main', subject: [`${space.id}:${result.data?.object.id}`] }),
390
- );
391
- },
392
- [dispatch],
393
- );
394
- return <TestingPanel onSpaceCreate={onSpaceCreate} onScriptPluginOpen={onScriptPluginOpen} />;
395
- },
396
- }),
397
- ]);
400
+ const feed = space.properties.invocationTraceFeed?.target;
401
+ const queueDxn = feed ? Feed.getQueueDxn(feed) : undefined;
402
+ return <InvocationTraceContainer db={space.db} queueDxn={queueDxn} detailAxis='block' />;
403
+ },
404
+ }),
405
+ Surface.create({
406
+ id: 'edge.testing',
407
+ filter: AppSurface.literal(AppSurface.Article, Devtools.Edge.Testing),
408
+ component: () => {
409
+ const { invokePromise } = useOperationInvoker();
410
+ const onSpaceCreate = useCallback(
411
+ async (space: Space) => {
412
+ await space.waitUntilReady();
413
+ await invokePromise(SpaceOperation.Migrate, { space });
414
+ await space.db.flush();
415
+ },
416
+ [invokePromise],
417
+ );
418
+ const onScriptPluginOpen = useCallback(
419
+ async (space: Space) => {
420
+ await space.waitUntilReady();
421
+ const createResult = await invokePromise(ScriptOperation.CreateScript, { db: space.db });
422
+ if (createResult.data?.object) {
423
+ await invokePromise(SpaceOperation.AddObject, { target: space.db, object: createResult.data.object });
424
+ }
425
+ log.info('script created', { result: createResult });
426
+ if (createResult.data?.object) {
427
+ await invokePromise(LayoutOperation.Open, {
428
+ subject: [getObjectPathFromObject(createResult.data.object)],
429
+ });
430
+ }
431
+ },
432
+ [invokePromise],
433
+ );
434
+ return <TestingPanel onSpaceCreate={onSpaceCreate} onScriptPluginOpen={onScriptPluginOpen} />;
435
+ },
436
+ }),
437
+ ]);
438
+ }),
439
+ );