@dxos/plugin-debug 0.8.4-main.ae835ea → 0.8.4-main.bcb3aa67d6

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