@dxos/plugin-debug 0.8.4-main.dedc0f3 → 0.8.4-main.dfabb4ec29

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 (213) hide show
  1. package/dist/lib/neutral/DebugGraph-G4FWS57E.mjs +15 -0
  2. package/dist/lib/neutral/DebugGraph-G4FWS57E.mjs.map +7 -0
  3. package/dist/lib/neutral/DebugObjectPanel-UJ63CV25.mjs +59 -0
  4. package/dist/lib/neutral/DebugObjectPanel-UJ63CV25.mjs.map +7 -0
  5. package/dist/lib/neutral/DebugPlugin.mjs +47 -0
  6. package/dist/lib/neutral/DebugPlugin.mjs.map +7 -0
  7. package/dist/lib/neutral/DebugPlugin.node.mjs +18 -0
  8. package/dist/lib/neutral/DebugPlugin.node.mjs.map +7 -0
  9. package/dist/lib/neutral/DebugSettings-Z3XADRNK.mjs +224 -0
  10. package/dist/lib/neutral/DebugSettings-Z3XADRNK.mjs.map +7 -0
  11. package/dist/lib/neutral/DebugSpaceObjectsPanel-NISULU6U.mjs +34 -0
  12. package/dist/lib/neutral/DebugSpaceObjectsPanel-NISULU6U.mjs.map +7 -0
  13. package/dist/lib/neutral/DebugStatus-YB3KFP7G.mjs +121 -0
  14. package/dist/lib/neutral/DebugStatus-YB3KFP7G.mjs.map +7 -0
  15. package/dist/lib/neutral/DevtoolsOverviewContainer-YX7Z3D2H.mjs +23 -0
  16. package/dist/lib/neutral/DevtoolsOverviewContainer-YX7Z3D2H.mjs.map +7 -0
  17. package/dist/lib/neutral/SpaceGenerator-UBYB4NPD.mjs +143 -0
  18. package/dist/lib/neutral/SpaceGenerator-UBYB4NPD.mjs.map +7 -0
  19. package/dist/lib/neutral/Wireframe-7SNRUKET.mjs +52 -0
  20. package/dist/lib/neutral/Wireframe-7SNRUKET.mjs.map +7 -0
  21. package/dist/lib/neutral/app-graph-builder-YPYHL2K5.mjs +577 -0
  22. package/dist/lib/neutral/app-graph-builder-YPYHL2K5.mjs.map +7 -0
  23. package/dist/lib/neutral/capabilities/index.mjs +15 -0
  24. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  25. package/dist/lib/neutral/chunk-3OGPOE7H.mjs +20 -0
  26. package/dist/lib/neutral/chunk-3OGPOE7H.mjs.map +7 -0
  27. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  28. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  29. package/dist/lib/{browser/chunk-AJA6RYN3.mjs → neutral/chunk-NFIOTQRZ.mjs} +30 -9
  30. package/dist/lib/neutral/chunk-NFIOTQRZ.mjs.map +7 -0
  31. package/dist/lib/{browser/SpaceGenerator-DANYBPYZ.mjs → neutral/components/index.mjs} +414 -411
  32. package/dist/lib/neutral/components/index.mjs.map +7 -0
  33. package/dist/lib/neutral/containers/index.mjs +21 -0
  34. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  35. package/dist/lib/neutral/index.mjs +18 -0
  36. package/dist/lib/neutral/index.mjs.map +7 -0
  37. package/dist/lib/neutral/meta.json +1 -0
  38. package/dist/lib/neutral/meta.mjs +8 -0
  39. package/dist/lib/neutral/meta.mjs.map +7 -0
  40. package/dist/lib/neutral/plugin.mjs +12 -0
  41. package/dist/lib/neutral/plugin.mjs.map +7 -0
  42. package/dist/lib/neutral/react-context-MUZ3KVLU.mjs +17 -0
  43. package/dist/lib/neutral/react-context-MUZ3KVLU.mjs.map +7 -0
  44. package/dist/lib/neutral/react-surface-NH2H63KW.mjs +420 -0
  45. package/dist/lib/neutral/react-surface-NH2H63KW.mjs.map +7 -0
  46. package/dist/lib/neutral/settings-MPM6YUP4.mjs +28 -0
  47. package/dist/lib/neutral/settings-MPM6YUP4.mjs.map +7 -0
  48. package/dist/lib/neutral/translations.mjs +83 -0
  49. package/dist/lib/neutral/translations.mjs.map +7 -0
  50. package/dist/lib/neutral/types/index.mjs +14 -0
  51. package/dist/lib/neutral/types/index.mjs.map +7 -0
  52. package/dist/types/src/DebugPlugin.d.ts +4 -1
  53. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  54. package/dist/types/src/DebugPlugin.node.d.ts +5 -0
  55. package/dist/types/src/DebugPlugin.node.d.ts.map +1 -0
  56. package/dist/types/src/DebugPlugin.test.d.ts +2 -0
  57. package/dist/types/src/DebugPlugin.test.d.ts.map +1 -0
  58. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  59. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  60. package/dist/types/src/capabilities/index.d.ts +8 -5
  61. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  62. package/dist/types/src/capabilities/react-context.d.ts +4 -2
  63. package/dist/types/src/capabilities/react-context.d.ts.map +1 -1
  64. package/dist/types/src/capabilities/react-surface.d.ts +7 -2
  65. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  66. package/dist/types/src/capabilities/settings.d.ts +5 -2
  67. package/dist/types/src/capabilities/settings.d.ts.map +1 -1
  68. package/dist/types/src/components/DebugSettings/DebugSettings.d.ts +11 -0
  69. package/dist/types/src/components/DebugSettings/DebugSettings.d.ts.map +1 -0
  70. package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts +99 -0
  71. package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts.map +1 -0
  72. package/dist/types/src/components/DebugSettings/index.d.ts +2 -0
  73. package/dist/types/src/components/DebugSettings/index.d.ts.map +1 -0
  74. package/dist/types/src/components/SchemaTable/SchemaTable.d.ts.map +1 -0
  75. package/dist/types/src/components/SchemaTable/index.d.ts +2 -0
  76. package/dist/types/src/components/SchemaTable/index.d.ts.map +1 -0
  77. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +5 -5
  78. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  79. package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
  80. package/dist/types/src/components/SpaceGenerator/index.d.ts +2 -2
  81. package/dist/types/src/components/SpaceGenerator/index.d.ts.map +1 -1
  82. package/dist/types/src/components/SpaceGenerator/presets.d.ts +4 -5
  83. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  84. package/dist/types/src/components/index.d.ts +4 -10
  85. package/dist/types/src/components/index.d.ts.map +1 -1
  86. package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts +8 -0
  87. package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts.map +1 -0
  88. package/dist/types/src/containers/DebugGraph/index.d.ts +2 -0
  89. package/dist/types/src/containers/DebugGraph/index.d.ts.map +1 -0
  90. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts +6 -0
  91. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -0
  92. package/dist/types/src/containers/DebugObjectPanel/index.d.ts +2 -0
  93. package/dist/types/src/containers/DebugObjectPanel/index.d.ts.map +1 -0
  94. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +5 -0
  95. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -0
  96. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts +2 -0
  97. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts.map +1 -0
  98. package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts.map +1 -0
  99. package/dist/types/src/containers/DebugStatus/index.d.ts +2 -0
  100. package/dist/types/src/containers/DebugStatus/index.d.ts.map +1 -0
  101. package/dist/types/src/{components → containers/DevtoolsOverviewContainer}/DevtoolsOverviewContainer.d.ts +0 -1
  102. package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts.map +1 -0
  103. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts +2 -0
  104. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +1 -0
  105. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts +11 -0
  106. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts.map +1 -0
  107. package/dist/types/src/containers/SpaceGenerator/index.d.ts +2 -0
  108. package/dist/types/src/containers/SpaceGenerator/index.d.ts.map +1 -0
  109. package/dist/types/src/{components → containers/Wireframe}/Wireframe.d.ts +2 -2
  110. package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -0
  111. package/dist/types/src/containers/Wireframe/index.d.ts +2 -0
  112. package/dist/types/src/containers/Wireframe/index.d.ts.map +1 -0
  113. package/dist/types/src/containers/index.d.ts +9 -0
  114. package/dist/types/src/containers/index.d.ts.map +1 -0
  115. package/dist/types/src/index.d.ts +1 -1
  116. package/dist/types/src/index.d.ts.map +1 -1
  117. package/dist/types/src/meta.d.ts +2 -3
  118. package/dist/types/src/meta.d.ts.map +1 -1
  119. package/dist/types/src/plugin.d.ts +4 -0
  120. package/dist/types/src/plugin.d.ts.map +1 -0
  121. package/dist/types/src/translations.d.ts +80 -59
  122. package/dist/types/src/translations.d.ts.map +1 -1
  123. package/dist/types/src/types/Settings.d.ts +8 -0
  124. package/dist/types/src/types/Settings.d.ts.map +1 -0
  125. package/dist/types/src/types/index.d.ts +69 -0
  126. package/dist/types/src/types/index.d.ts.map +1 -0
  127. package/dist/types/tsconfig.tsbuildinfo +1 -1
  128. package/package.json +131 -72
  129. package/src/DebugPlugin.node.ts +18 -0
  130. package/src/DebugPlugin.test.ts +29 -0
  131. package/src/DebugPlugin.tsx +30 -37
  132. package/src/capabilities/app-graph-builder.ts +362 -387
  133. package/src/capabilities/index.ts +5 -5
  134. package/src/capabilities/react-context.tsx +16 -7
  135. package/src/capabilities/react-surface.tsx +379 -338
  136. package/src/capabilities/settings.ts +24 -12
  137. package/src/components/DebugSettings/DebugSettings.stories.tsx +36 -0
  138. package/src/components/DebugSettings/DebugSettings.tsx +262 -0
  139. package/src/components/DebugSettings/index.ts +5 -0
  140. package/src/components/SchemaTable/index.ts +5 -0
  141. package/src/components/SpaceGenerator/ObjectGenerator.tsx +33 -41
  142. package/src/components/SpaceGenerator/draw-util.ts +10 -10
  143. package/src/components/SpaceGenerator/index.ts +2 -3
  144. package/src/components/SpaceGenerator/presets.ts +310 -48
  145. package/src/components/index.ts +4 -8
  146. package/src/containers/DebugGraph/DebugGraph.tsx +14 -0
  147. package/src/containers/DebugGraph/index.ts +5 -0
  148. package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +76 -0
  149. package/src/containers/DebugObjectPanel/index.ts +5 -0
  150. package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +47 -0
  151. package/src/containers/DebugSpaceObjectsPanel/index.ts +5 -0
  152. package/src/{components → containers/DebugStatus}/DebugStatus.tsx +43 -21
  153. package/src/containers/DebugStatus/index.ts +5 -0
  154. package/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx +25 -0
  155. package/src/containers/DevtoolsOverviewContainer/index.ts +5 -0
  156. package/src/containers/SpaceGenerator/SpaceGenerator.tsx +126 -0
  157. package/src/containers/SpaceGenerator/index.ts +5 -0
  158. package/src/{components → containers/Wireframe}/Wireframe.tsx +7 -12
  159. package/src/containers/Wireframe/index.ts +5 -0
  160. package/src/containers/index.ts +13 -0
  161. package/src/index.ts +1 -1
  162. package/src/meta.ts +8 -7
  163. package/src/plugin.ts +10 -0
  164. package/src/translations.ts +75 -58
  165. package/src/types/Settings.ts +16 -0
  166. package/src/{types.ts → types/index.ts} +20 -11
  167. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +0 -20
  168. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +0 -7
  169. package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs +0 -25
  170. package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs.map +0 -7
  171. package/dist/lib/browser/SpaceGenerator-DANYBPYZ.mjs.map +0 -7
  172. package/dist/lib/browser/app-graph-builder-JTIEFOWZ.mjs +0 -587
  173. package/dist/lib/browser/app-graph-builder-JTIEFOWZ.mjs.map +0 -7
  174. package/dist/lib/browser/chunk-5XPIRNQS.mjs +0 -18
  175. package/dist/lib/browser/chunk-5XPIRNQS.mjs.map +0 -7
  176. package/dist/lib/browser/chunk-AJA6RYN3.mjs.map +0 -7
  177. package/dist/lib/browser/index.mjs +0 -133
  178. package/dist/lib/browser/index.mjs.map +0 -7
  179. package/dist/lib/browser/meta.json +0 -1
  180. package/dist/lib/browser/react-context-NVAGLAJD.mjs +0 -16
  181. package/dist/lib/browser/react-context-NVAGLAJD.mjs.map +0 -7
  182. package/dist/lib/browser/react-surface-YLOWSIBU.mjs +0 -773
  183. package/dist/lib/browser/react-surface-YLOWSIBU.mjs.map +0 -7
  184. package/dist/lib/browser/settings-LSSWLM5I.mjs +0 -22
  185. package/dist/lib/browser/settings-LSSWLM5I.mjs.map +0 -7
  186. package/dist/types/src/components/Container.d.ts +0 -5
  187. package/dist/types/src/components/Container.d.ts.map +0 -1
  188. package/dist/types/src/components/DebugGraph.d.ts +0 -8
  189. package/dist/types/src/components/DebugGraph.d.ts.map +0 -1
  190. package/dist/types/src/components/DebugObjectPanel.d.ts +0 -7
  191. package/dist/types/src/components/DebugObjectPanel.d.ts.map +0 -1
  192. package/dist/types/src/components/DebugSettings.d.ts +0 -6
  193. package/dist/types/src/components/DebugSettings.d.ts.map +0 -1
  194. package/dist/types/src/components/DebugStatus.d.ts.map +0 -1
  195. package/dist/types/src/components/DevtoolsOverviewContainer.d.ts.map +0 -1
  196. package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +0 -1
  197. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +0 -9
  198. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +0 -1
  199. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +0 -16
  200. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +0 -1
  201. package/dist/types/src/components/Wireframe.d.ts.map +0 -1
  202. package/dist/types/src/types.d.ts +0 -63
  203. package/dist/types/src/types.d.ts.map +0 -1
  204. package/src/components/Container.tsx +0 -15
  205. package/src/components/DebugGraph.tsx +0 -14
  206. package/src/components/DebugObjectPanel.tsx +0 -35
  207. package/src/components/DebugSettings.tsx +0 -159
  208. package/src/components/DevtoolsOverviewContainer.tsx +0 -20
  209. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +0 -54
  210. package/src/components/SpaceGenerator/SpaceGenerator.tsx +0 -122
  211. /package/dist/types/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.d.ts +0 -0
  212. /package/dist/types/src/{components → containers/DebugStatus}/DebugStatus.d.ts +0 -0
  213. /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
- LayoutAction,
11
- type PluginContext,
12
- chain,
13
- contributes,
14
- createIntent,
15
- createSurface,
16
- useCapability,
17
- useIntentDispatcher,
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 } 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 { 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,
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,327 +67,373 @@ type SpaceDebug = {
72
67
  };
73
68
 
74
69
  type GraphDebug = {
75
- graph: Graph;
70
+ graph: Graph.Graph;
76
71
  root: string;
77
72
  };
78
73
 
79
- const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${DEBUG_PLUGIN}/space` && isSpace(data.space);
80
- const isGraphDebug = (data: any): data is GraphDebug => data?.graph instanceof Graph && typeof data?.root === 'string';
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
+ };
81
81
 
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;
82
+ type ReactSurfaceOptions = {
83
+ logStore?: IdbLogStore;
89
84
  };
90
85
 
91
- export default (context: PluginContext) =>
92
- contributes(Capabilities.ReactSurface, [
93
- createSurface({
94
- id: `${DEBUG_PLUGIN}/plugin-settings`,
95
- role: 'article',
96
- filter: (data): data is { subject: SettingsStore<DebugSettingsProps> } =>
97
- data.subject instanceof SettingsStore && data.subject.prefix === DEBUG_PLUGIN,
98
- component: ({ data: { subject } }) => <DebugSettings settings={subject.value} />,
99
- }),
100
- createSurface({
101
- id: `${DEBUG_PLUGIN}/space`,
102
- role: 'article',
103
- filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),
104
- component: ({ data }) => {
105
- 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
+ }
106
314
 
107
- const handleCreateObject = useCallback(
108
- (objects: Obj.Any[]) => {
109
- if (!isSpace(data.subject.space)) {
110
- return;
111
- }
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
+ }
112
326
 
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
- }
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
+ }
119
343
 
120
- objects.forEach((object) => {
121
- void dispatch(createIntent(SpaceAction.AddObject, { target: collection, object }));
122
- });
123
- },
124
- [data.subject.space],
125
- );
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
+ }
126
370
 
127
- return (
128
- <StackItem.Content>
129
- <SpaceGenerator space={data.subject.space} onCreateObjects={handleCreateObject} />
130
- </StackItem.Content>
131
- );
132
- },
133
- }),
134
- createSurface({
135
- id: `${DEBUG_PLUGIN}/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: `${DEBUG_PLUGIN}/wireframe`,
142
- role: ['article', 'section'],
143
- position: 'hoist',
144
- filter: (data): data is { subject: Obj.Any } => {
145
- const settings = context
146
- .getCapability(Capabilities.SettingsStore)
147
- .getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;
148
- return Obj.isObject(data.subject) && !!settings.wireframe;
149
- },
150
- component: ({ data, role }) => (
151
- <Wireframe label={`${role}:${name}`} object={data.subject} classNames='row-span-2 overflow-hidden' />
152
- ),
153
- }),
154
- createSurface({
155
- id: `${DEBUG_PLUGIN}/object-debug`,
156
- role: 'article',
157
- filter: (data): data is { companionTo: Obj.Any } => data.subject === 'debug' && Obj.isObject(data.companionTo),
158
- component: ({ data }) => <DebugObjectPanel object={data.companionTo} />,
159
- }),
160
- createSurface({
161
- id: `${DEBUG_PLUGIN}/devtools-overview`,
162
- role: 'deck-companion--devtools',
163
- component: () => <DevtoolsOverviewContainer />,
164
- }),
165
- createSurface({
166
- id: `${DEBUG_PLUGIN}/status`,
167
- role: 'status',
168
- component: () => <DebugStatus />,
169
- }),
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
+ }
170
387
 
171
- //
172
- // Devtools
173
- //
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
+ }
174
399
 
175
- createSurface({
176
- id: `${DEBUG_PLUGIN}/client/config`,
177
- role: 'article',
178
- filter: (data): data is any => data.subject === Devtools.Client.Config,
179
- component: () => <ConfigPanel vaultSelector={false} />,
180
- }),
181
- createSurface({
182
- id: `${DEBUG_PLUGIN}/client/storage`,
183
- role: 'article',
184
- filter: (data): data is any => data.subject === Devtools.Client.Storage,
185
- component: () => <StoragePanel />,
186
- }),
187
- createSurface({
188
- id: `${DEBUG_PLUGIN}/client/logs`,
189
- role: 'article',
190
- filter: (data): data is any => data.subject === Devtools.Client.Logs,
191
- component: () => <LoggingPanel />,
192
- }),
193
- createSurface({
194
- id: `${DEBUG_PLUGIN}/client/diagnostics`,
195
- role: 'article',
196
- filter: (data): data is any => data.subject === Devtools.Client.Diagnostics,
197
- component: () => <DiagnosticsPanel />,
198
- }),
199
- createSurface({
200
- id: `${DEBUG_PLUGIN}/client/tracing`,
201
- role: 'article',
202
- filter: (data): data is any => data.subject === Devtools.Client.Tracing,
203
- component: () => <TracingPanel />,
204
- }),
205
- createSurface({
206
- id: `${DEBUG_PLUGIN}/halo/identity`,
207
- role: 'article',
208
- filter: (data): data is any => data.subject === Devtools.Halo.Identity,
209
- component: () => <IdentityPanel />,
210
- }),
211
- createSurface({
212
- id: `${DEBUG_PLUGIN}/halo/devices`,
213
- role: 'article',
214
- filter: (data): data is any => data.subject === Devtools.Halo.Devices,
215
- component: () => <DeviceListPanel />,
216
- }),
217
- createSurface({
218
- id: `${DEBUG_PLUGIN}/halo/keyring`,
219
- role: 'article',
220
- filter: (data): data is any => data.subject === Devtools.Halo.Keyring,
221
- component: () => <KeyringPanel />,
222
- }),
223
- createSurface({
224
- id: `${DEBUG_PLUGIN}/halo/credentials`,
225
- role: 'article',
226
- filter: (data): data is any => data.subject === Devtools.Halo.Credentials,
227
- component: () => {
228
- const space = useCurrentSpace();
229
- return <CredentialsPanel space={space} />;
230
- },
231
- }),
232
- createSurface({
233
- id: `${DEBUG_PLUGIN}/echo/spaces`,
234
- role: 'article',
235
- filter: (data): data is any => data.subject === Devtools.Echo.Spaces,
236
- component: () => {
237
- const { dispatchPromise: dispatch } = useIntentDispatcher();
238
- const handleSelect = useCallback(
239
- () => dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [Devtools.Echo.Space] })),
240
- [dispatch],
241
- );
242
- return <SpaceListPanel onSelect={handleSelect} />;
243
- },
244
- }),
245
- createSurface({
246
- id: `${DEBUG_PLUGIN}/echo/space`,
247
- role: 'article',
248
- filter: (data): data is any => data.subject === Devtools.Echo.Space,
249
- component: () => {
250
- const space = useCurrentSpace();
251
- const { dispatchPromise: dispatch } = useIntentDispatcher();
252
- const handleSelect = useCallback(
253
- () => dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [Devtools.Echo.Feeds] })),
254
- [dispatch],
255
- );
256
- return <SpaceInfoPanel space={space} onSelectFeed={handleSelect} onSelectPipeline={handleSelect} />;
257
- },
258
- }),
259
- createSurface({
260
- id: `${DEBUG_PLUGIN}/echo/feeds`,
261
- role: 'article',
262
- filter: (data): data is any => data.subject === Devtools.Echo.Feeds,
263
- component: () => {
264
- const space = useCurrentSpace();
265
- return <FeedsPanel space={space} />;
266
- },
267
- }),
268
- createSurface({
269
- id: `${DEBUG_PLUGIN}/echo/objects`,
270
- role: 'article',
271
- filter: (data): data is any => data.subject === Devtools.Echo.Objects,
272
- component: () => {
273
- const space = useCurrentSpace();
274
- return <ObjectsPanel space={space} />;
275
- },
276
- }),
277
- createSurface({
278
- id: `${DEBUG_PLUGIN}/echo/schema`,
279
- role: 'article',
280
- filter: (data): data is any => data.subject === Devtools.Echo.Schema,
281
- component: () => {
282
- const space = useCurrentSpace();
283
- return <SchemaPanel space={space} />;
284
- },
285
- }),
286
- createSurface({
287
- id: `${DEBUG_PLUGIN}/echo/automerge`,
288
- role: 'article',
289
- filter: (data): data is any => data.subject === Devtools.Echo.Automerge,
290
- component: () => {
291
- const space = useCurrentSpace();
292
- return <AutomergePanel space={space} />;
293
- },
294
- }),
295
- createSurface({
296
- id: `${DEBUG_PLUGIN}/echo/queues`,
297
- role: 'article',
298
- filter: (data): data is any => data.subject === Devtools.Echo.Queues,
299
- component: () => <QueuesPanel />,
300
- }),
301
- createSurface({
302
- id: `${DEBUG_PLUGIN}/echo/members`,
303
- role: 'article',
304
- filter: (data): data is any => data.subject === Devtools.Echo.Members,
305
- component: () => {
306
- const space = useCurrentSpace();
307
- return <MembersPanel space={space} />;
308
- },
309
- }),
310
- createSurface({
311
- id: `${DEBUG_PLUGIN}/echo/metadata`,
312
- role: 'article',
313
- filter: (data): data is any => data.subject === Devtools.Echo.Metadata,
314
- component: () => <MetadataPanel />,
315
- }),
316
- createSurface({
317
- id: `${DEBUG_PLUGIN}/mesh/signal`,
318
- role: 'article',
319
- filter: (data): data is any => data.subject === Devtools.Mesh.Signal,
320
- component: () => <SignalPanel />,
321
- }),
322
- createSurface({
323
- id: `${DEBUG_PLUGIN}/mesh/swarm`,
324
- role: 'article',
325
- filter: (data): data is any => data.subject === Devtools.Mesh.Swarm,
326
- component: () => <SwarmPanel />,
327
- }),
328
- createSurface({
329
- id: `${DEBUG_PLUGIN}/mesh/network`,
330
- role: 'article',
331
- filter: (data): data is any => data.subject === Devtools.Mesh.Network,
332
- component: () => {
333
- const space = useCurrentSpace();
334
- return <NetworkPanel space={space} />;
335
- },
336
- }),
337
- // TODO(wittjosiah): Remove?
338
- // createSurface({
339
- // id: `${DEBUG_PLUGIN}/agent/dashboard`,
340
- // role: 'article',
341
- // filter: (data): data is any => data.subject === Devtools.Agent.Dashboard,
342
- // component: () => <DashboardPanel />,
343
- // }),
344
- createSurface({
345
- id: `${DEBUG_PLUGIN}/edge/dashboard`,
346
- role: 'article',
347
- filter: (data): data is any => data.subject === Devtools.Edge.Dashboard,
348
- component: () => <EdgeDashboardPanel />,
349
- }),
350
- createSurface({
351
- id: `${DEBUG_PLUGIN}/edge/workflows`,
352
- role: 'article',
353
- filter: (data): data is any => data.subject === Devtools.Edge.Workflows,
354
- component: () => {
355
- const space = useCurrentSpace();
356
- return <WorkflowPanel space={space} />;
357
- },
358
- }),
359
- createSurface({
360
- id: `${DEBUG_PLUGIN}/edge/traces`,
361
- role: 'article',
362
- filter: (data): data is any => data.subject === Devtools.Edge.Traces,
363
- component: () => {
364
- const space = useCurrentSpace();
365
- return <InvocationTraceContainer space={space} detailAxis='block' />;
366
- },
367
- }),
368
- createSurface({
369
- id: `${DEBUG_PLUGIN}/edge/testing`,
370
- role: 'article',
371
- filter: (data): data is any => data.subject === Devtools.Edge.Testing,
372
- component: () => {
373
- const { dispatchPromise: dispatch } = useIntentDispatcher();
374
- const onSpaceCreate = useCallback(
375
- async (space: Space) => {
376
- await space.waitUntilReady();
377
- await dispatch(createIntent(SpaceAction.Migrate, { space }));
378
- await space.db.flush();
379
- },
380
- [dispatch],
381
- );
382
- const onScriptPluginOpen = useCallback(
383
- async (space: Space) => {
384
- await space.waitUntilReady();
385
- const result = await dispatch(
386
- pipe(createIntent(ScriptAction.Create, { space }), chain(SpaceAction.AddObject, { target: space })),
387
- );
388
- log.info('script created', { result });
389
- await dispatch(
390
- createIntent(LayoutAction.Open, { part: 'main', subject: [`${space.id}:${result.data?.object.id}`] }),
391
- );
392
- },
393
- [dispatch],
394
- );
395
- return <TestingPanel onSpaceCreate={onSpaceCreate} onScriptPluginOpen={onScriptPluginOpen} />;
396
- },
397
- }),
398
- ]);
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
+ );