@dxos/plugin-debug 0.8.4-main.c4373fc → 0.8.4-main.d9fc60f731

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