@dxos/plugin-debug 0.8.0 → 0.8.1-main.81238a8

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 (73) hide show
  1. package/dist/lib/browser/{DebugApp-LQHFFK3Y.mjs → DebugApp-7PFYN52J.mjs} +30 -23
  2. package/dist/lib/browser/{DebugApp-LQHFFK3Y.mjs.map → DebugApp-7PFYN52J.mjs.map} +4 -4
  3. package/dist/lib/browser/{SpaceGenerator-SPEJBGP7.mjs → SpaceGenerator-ATLTIBZ2.mjs} +2 -2
  4. package/dist/lib/browser/{SpaceGenerator-SPEJBGP7.mjs.map → SpaceGenerator-ATLTIBZ2.mjs.map} +1 -1
  5. package/dist/lib/browser/{app-graph-builder-5STXPSZJ.mjs → app-graph-builder-EJHONTKA.mjs} +87 -29
  6. package/dist/lib/browser/{app-graph-builder-5STXPSZJ.mjs.map → app-graph-builder-EJHONTKA.mjs.map} +3 -3
  7. package/dist/lib/browser/{chunk-Y4ZZEHUN.mjs → chunk-F2R7TJCJ.mjs} +2 -2
  8. package/dist/lib/browser/{chunk-Y4ZZEHUN.mjs.map → chunk-F2R7TJCJ.mjs.map} +3 -3
  9. package/dist/lib/browser/{chunk-EF3UVAVI.mjs → chunk-RORUXVAC.mjs} +1 -1
  10. package/dist/lib/browser/chunk-RORUXVAC.mjs.map +7 -0
  11. package/dist/lib/browser/index.mjs +7 -6
  12. package/dist/lib/browser/index.mjs.map +2 -2
  13. package/dist/lib/browser/meta.json +1 -1
  14. package/dist/lib/browser/{react-context-TCD3MNIT.mjs → react-context-ZRLN5KUI.mjs} +2 -2
  15. package/dist/lib/browser/{react-surface-GLOHHHOD.mjs → react-surface-XWBF5EHO.mjs} +38 -23
  16. package/dist/lib/browser/react-surface-XWBF5EHO.mjs.map +7 -0
  17. package/dist/lib/browser/{settings-XWFV3P44.mjs → settings-R47ZDKXO.mjs} +5 -5
  18. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  19. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  20. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  21. package/dist/types/src/components/Container.d.ts +2 -2
  22. package/dist/types/src/components/Container.d.ts.map +1 -1
  23. package/dist/types/src/components/DebugObjectPanel.d.ts +2 -1
  24. package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
  25. package/dist/types/src/components/DebugSettings.d.ts +2 -1
  26. package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
  27. package/dist/types/src/components/DebugStatus.d.ts +2 -1
  28. package/dist/types/src/components/DebugStatus.d.ts.map +1 -1
  29. package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts +2 -1
  30. package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +1 -1
  31. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +2 -1
  32. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
  33. package/dist/types/src/components/Wireframe.d.ts +2 -1
  34. package/dist/types/src/components/Wireframe.d.ts.map +1 -1
  35. package/dist/types/src/components/index.d.ts +1 -5
  36. package/dist/types/src/components/index.d.ts.map +1 -1
  37. package/dist/types/src/meta.d.ts +2 -9
  38. package/dist/types/src/meta.d.ts.map +1 -1
  39. package/dist/types/src/translations.d.ts +1 -0
  40. package/dist/types/src/translations.d.ts.map +1 -1
  41. package/dist/types/src/types.d.ts +1 -0
  42. package/dist/types/src/types.d.ts.map +1 -1
  43. package/package.json +49 -49
  44. package/src/capabilities/app-graph-builder.ts +53 -15
  45. package/src/capabilities/react-surface.tsx +30 -24
  46. package/src/components/SpaceGenerator/SpaceGenerator.tsx +1 -1
  47. package/src/components/index.ts +0 -1
  48. package/src/meta.ts +2 -2
  49. package/src/translations.ts +1 -0
  50. package/src/types.ts +1 -0
  51. package/dist/lib/browser/DebugSpace-EBJYT5JG.mjs +0 -277
  52. package/dist/lib/browser/DebugSpace-EBJYT5JG.mjs.map +0 -7
  53. package/dist/lib/browser/chunk-EF3UVAVI.mjs.map +0 -7
  54. package/dist/lib/browser/chunk-GSJS3HEM.mjs +0 -15
  55. package/dist/lib/browser/chunk-GSJS3HEM.mjs.map +0 -7
  56. package/dist/lib/browser/react-surface-GLOHHHOD.mjs.map +0 -7
  57. package/dist/types/src/components/DebugSpace/DebugSpace.d.ts +0 -8
  58. package/dist/types/src/components/DebugSpace/DebugSpace.d.ts.map +0 -1
  59. package/dist/types/src/components/DebugSpace/DebugSpace.stories.d.ts +0 -6
  60. package/dist/types/src/components/DebugSpace/DebugSpace.stories.d.ts.map +0 -1
  61. package/dist/types/src/components/DebugSpace/ObjectCreator.d.ts +0 -14
  62. package/dist/types/src/components/DebugSpace/ObjectCreator.d.ts.map +0 -1
  63. package/dist/types/src/components/DebugSpace/ObjectCreator.stories.d.ts +0 -6
  64. package/dist/types/src/components/DebugSpace/ObjectCreator.stories.d.ts.map +0 -1
  65. package/dist/types/src/components/DebugSpace/index.d.ts +0 -3
  66. package/dist/types/src/components/DebugSpace/index.d.ts.map +0 -1
  67. package/src/components/DebugSpace/DebugSpace.stories.tsx +0 -46
  68. package/src/components/DebugSpace/DebugSpace.tsx +0 -183
  69. package/src/components/DebugSpace/ObjectCreator.stories.tsx +0 -51
  70. package/src/components/DebugSpace/ObjectCreator.tsx +0 -100
  71. package/src/components/DebugSpace/index.ts +0 -7
  72. /package/dist/lib/browser/{react-context-TCD3MNIT.mjs.map → react-context-ZRLN5KUI.mjs.map} +0 -0
  73. /package/dist/lib/browser/{settings-XWFV3P44.mjs.map → settings-R47ZDKXO.mjs.map} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-debug",
3
- "version": "0.8.0",
3
+ "version": "0.8.1-main.81238a8",
4
4
  "description": "DXOS Surface plugin for testing.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -28,52 +28,52 @@
28
28
  "@preact/signals-core": "^1.6.0",
29
29
  "@tldraw/tldraw": "^3.0.0",
30
30
  "date-fns": "^3.3.1",
31
- "effect": "^3.12.3",
31
+ "effect": "3.13.3",
32
32
  "lodash.get": "^4.4.2",
33
33
  "react-json-tree": "^0.18.0",
34
34
  "react-resize-detector": "^11.0.1",
35
35
  "workerize-loader": "^2.0.2",
36
- "@dxos/app-framework": "0.8.0",
37
- "@dxos/async": "0.8.0",
38
- "@dxos/automerge": "0.8.0",
39
- "@dxos/client-services": "0.8.0",
40
- "@dxos/compute": "0.8.0",
41
- "@dxos/config": "0.8.0",
42
- "@dxos/devtools": "0.8.0",
43
- "@dxos/echo-generator": "0.8.0",
44
- "@dxos/conductor": "0.8.0",
45
- "@dxos/echo-schema": "0.8.0",
46
- "@dxos/functions": "0.8.0",
47
- "@dxos/echo-pipeline": "0.8.0",
48
- "@dxos/invariant": "0.8.0",
49
- "@dxos/keys": "0.8.0",
50
- "@dxos/live-object": "0.8.0",
51
- "@dxos/local-storage": "0.8.0",
52
- "@dxos/log": "0.8.0",
53
- "@dxos/plugin-deck": "0.8.0",
54
- "@dxos/plugin-client": "0.8.0",
55
- "@dxos/plugin-graph": "0.8.0",
56
- "@dxos/plugin-markdown": "0.8.0",
57
- "@dxos/plugin-sketch": "0.8.0",
58
- "@dxos/plugin-sheet": "0.8.0",
59
- "@dxos/plugin-space": "0.8.0",
60
- "@dxos/plugin-status-bar": "0.8.0",
61
- "@dxos/plugin-theme": "0.8.0",
62
- "@dxos/plugin-table": "0.8.0",
63
- "@dxos/protocols": "0.8.0",
64
- "@dxos/random": "0.8.0",
65
- "@dxos/react-client": "0.8.0",
66
- "@dxos/react-hooks": "0.8.0",
67
- "@dxos/react-ui-canvas-compute": "0.8.0",
68
- "@dxos/react-ui-attention": "0.8.0",
69
- "@dxos/react-ui-canvas-editor": "0.8.0",
70
- "@dxos/react-ui-form": "0.8.0",
71
- "@dxos/react-ui-kanban": "0.8.0",
72
- "@dxos/react-ui-stack": "0.8.0",
73
- "@dxos/react-ui-syntax-highlighter": "0.8.0",
74
- "@dxos/react-ui-table": "0.8.0",
75
- "@dxos/schema": "0.8.0",
76
- "@dxos/util": "0.8.0"
36
+ "@dxos/app-framework": "0.8.1-main.81238a8",
37
+ "@dxos/async": "0.8.1-main.81238a8",
38
+ "@dxos/client-services": "0.8.1-main.81238a8",
39
+ "@dxos/automerge": "0.8.1-main.81238a8",
40
+ "@dxos/compute": "0.8.1-main.81238a8",
41
+ "@dxos/conductor": "0.8.1-main.81238a8",
42
+ "@dxos/devtools": "0.8.1-main.81238a8",
43
+ "@dxos/echo-pipeline": "0.8.1-main.81238a8",
44
+ "@dxos/echo-generator": "0.8.1-main.81238a8",
45
+ "@dxos/echo-schema": "0.8.1-main.81238a8",
46
+ "@dxos/config": "0.8.1-main.81238a8",
47
+ "@dxos/functions": "0.8.1-main.81238a8",
48
+ "@dxos/invariant": "0.8.1-main.81238a8",
49
+ "@dxos/live-object": "0.8.1-main.81238a8",
50
+ "@dxos/keys": "0.8.1-main.81238a8",
51
+ "@dxos/local-storage": "0.8.1-main.81238a8",
52
+ "@dxos/log": "0.8.1-main.81238a8",
53
+ "@dxos/plugin-deck": "0.8.1-main.81238a8",
54
+ "@dxos/plugin-client": "0.8.1-main.81238a8",
55
+ "@dxos/plugin-graph": "0.8.1-main.81238a8",
56
+ "@dxos/plugin-markdown": "0.8.1-main.81238a8",
57
+ "@dxos/plugin-sketch": "0.8.1-main.81238a8",
58
+ "@dxos/plugin-sheet": "0.8.1-main.81238a8",
59
+ "@dxos/plugin-status-bar": "0.8.1-main.81238a8",
60
+ "@dxos/plugin-table": "0.8.1-main.81238a8",
61
+ "@dxos/protocols": "0.8.1-main.81238a8",
62
+ "@dxos/plugin-space": "0.8.1-main.81238a8",
63
+ "@dxos/plugin-theme": "0.8.1-main.81238a8",
64
+ "@dxos/react-ui-attention": "0.8.1-main.81238a8",
65
+ "@dxos/random": "0.8.1-main.81238a8",
66
+ "@dxos/react-hooks": "0.8.1-main.81238a8",
67
+ "@dxos/react-ui-canvas-compute": "0.8.1-main.81238a8",
68
+ "@dxos/react-client": "0.8.1-main.81238a8",
69
+ "@dxos/react-ui-canvas-editor": "0.8.1-main.81238a8",
70
+ "@dxos/react-ui-form": "0.8.1-main.81238a8",
71
+ "@dxos/react-ui-stack": "0.8.1-main.81238a8",
72
+ "@dxos/react-ui-syntax-highlighter": "0.8.1-main.81238a8",
73
+ "@dxos/react-ui-table": "0.8.1-main.81238a8",
74
+ "@dxos/react-ui-kanban": "0.8.1-main.81238a8",
75
+ "@dxos/schema": "0.8.1-main.81238a8",
76
+ "@dxos/util": "0.8.1-main.81238a8"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@phosphor-icons/react": "^2.1.5",
@@ -83,17 +83,17 @@
83
83
  "react": "~18.2.0",
84
84
  "react-dom": "~18.2.0",
85
85
  "vite": "5.4.7",
86
- "@dxos/react-ui": "0.8.0",
87
- "@dxos/react-ui-theme": "0.8.0",
88
- "@dxos/storybook-utils": "0.8.0"
86
+ "@dxos/react-ui": "0.8.1-main.81238a8",
87
+ "@dxos/storybook-utils": "0.8.1-main.81238a8",
88
+ "@dxos/react-ui-theme": "0.8.1-main.81238a8"
89
89
  },
90
90
  "peerDependencies": {
91
91
  "@phosphor-icons/react": "^2.1.5",
92
92
  "react": "~18.2.0",
93
93
  "react-dom": "~18.2.0",
94
- "@dxos/random": "0.8.0",
95
- "@dxos/react-ui": "0.8.0",
96
- "@dxos/react-ui-theme": "0.8.0"
94
+ "@dxos/random": "0.8.1-main.81238a8",
95
+ "@dxos/react-ui": "0.8.1-main.81238a8",
96
+ "@dxos/react-ui-theme": "0.8.1-main.81238a8"
97
97
  },
98
98
  "publishConfig": {
99
99
  "access": "public"
@@ -272,15 +272,6 @@ export default (context: PluginsContext) =>
272
272
  icon: 'ph--computer-tower--regular',
273
273
  },
274
274
  },
275
- {
276
- id: Devtools.Agent.Search,
277
- data: Devtools.Agent.Search,
278
- type: DEVTOOLS_TYPE,
279
- properties: {
280
- label: ['search label', { ns: DEBUG_PLUGIN }],
281
- icon: 'ph--magnifying-glass--regular',
282
- },
283
- },
284
275
  ],
285
276
  },
286
277
  {
@@ -310,6 +301,15 @@ export default (context: PluginsContext) =>
310
301
  icon: 'ph--function--regular',
311
302
  },
312
303
  },
304
+ {
305
+ id: Devtools.Edge.Traces,
306
+ data: Devtools.Edge.Traces,
307
+ type: DEVTOOLS_TYPE,
308
+ properties: {
309
+ label: ['traces label', { ns: DEBUG_PLUGIN }],
310
+ icon: 'ph--line-segments--regular',
311
+ },
312
+ },
313
313
  ],
314
314
  },
315
315
  ],
@@ -379,14 +379,52 @@ export default (context: PluginsContext) =>
379
379
 
380
380
  return [
381
381
  {
382
- // TODO(wittjosiah): Cannot use slashes in ids until we have a router which decouples ids from url paths.
383
- id: `${space.id}-debug`, // TODO(burdon): Change to slashes consistently.
384
- type: 'dxos.org/plugin/debug/space',
385
- data: { space, type: 'dxos.org/plugin/debug/space' },
382
+ id: `${space.id}-${Devtools.id}`,
383
+ data: null,
384
+ type: DEVTOOLS_TYPE,
386
385
  properties: {
387
- label: ['debug label', { ns: DEBUG_PLUGIN }],
388
- icon: 'ph--bug--regular',
386
+ label: ['devtools label', { ns: DEBUG_PLUGIN }],
387
+ icon: 'ph--hammer--regular',
389
388
  },
389
+ nodes: [
390
+ {
391
+ // TODO(wittjosiah): Cannot use slashes in ids until we have a router which decouples ids from url paths.
392
+ id: `${space.id}-debug`,
393
+ type: 'dxos.org/plugin/debug/space',
394
+ data: { space, type: 'dxos.org/plugin/debug/space' },
395
+ properties: {
396
+ label: ['debug label', { ns: DEBUG_PLUGIN }],
397
+ icon: 'ph--bug--regular',
398
+ },
399
+ },
400
+ {
401
+ id: `${space.id}-${Devtools.Echo.Space}`,
402
+ data: Devtools.Echo.Space,
403
+ type: DEVTOOLS_TYPE,
404
+ properties: {
405
+ label: ['space label', { ns: DEBUG_PLUGIN }],
406
+ icon: 'ph--planet--regular',
407
+ },
408
+ },
409
+ {
410
+ id: `${space.id}-${Devtools.Echo.Objects}`,
411
+ data: Devtools.Echo.Objects,
412
+ type: DEVTOOLS_TYPE,
413
+ properties: {
414
+ label: ['objects label', { ns: DEBUG_PLUGIN }],
415
+ icon: 'ph--database--regular',
416
+ },
417
+ },
418
+ {
419
+ id: `${space.id}-${Devtools.Edge.Traces}`,
420
+ data: Devtools.Edge.Traces,
421
+ type: DEVTOOLS_TYPE,
422
+ properties: {
423
+ label: ['traces label', { ns: DEBUG_PLUGIN }],
424
+ icon: 'ph--line-segments--regular',
425
+ },
426
+ },
427
+ ],
390
428
  },
391
429
  ];
392
430
  },
@@ -10,6 +10,7 @@ import {
10
10
  createIntent,
11
11
  createSurface,
12
12
  LayoutAction,
13
+ useCapability,
13
14
  type PluginsContext,
14
15
  } from '@dxos/app-framework';
15
16
  import {
@@ -33,12 +34,13 @@ import {
33
34
  TracingPanel,
34
35
  DashboardPanel,
35
36
  EdgeDashboardPanel,
36
- SearchPanel,
37
37
  AutomergePanel,
38
38
  WorkflowPanel,
39
39
  QueuesPanel,
40
+ InvocationTracePanel,
40
41
  } from '@dxos/devtools';
41
42
  import { SettingsStore } from '@dxos/local-storage';
43
+ import { ClientCapabilities } from '@dxos/plugin-client';
42
44
  import { Graph } from '@dxos/plugin-graph';
43
45
  import { SpaceAction, CollectionType } from '@dxos/plugin-space/types';
44
46
  import {
@@ -48,17 +50,10 @@ import {
48
50
  type ReactiveEchoObject,
49
51
  type ReactiveObject,
50
52
  type Space,
53
+ parseId,
51
54
  } from '@dxos/react-client/echo';
52
55
 
53
- import {
54
- DebugApp,
55
- DebugObjectPanel,
56
- DebugSettings,
57
- DebugSpace,
58
- DebugStatus,
59
- SpaceGenerator,
60
- Wireframe,
61
- } from '../components';
56
+ import { DebugApp, DebugObjectPanel, DebugSettings, DebugStatus, SpaceGenerator, Wireframe } from '../components';
62
57
  import { DEBUG_PLUGIN } from '../meta';
63
58
  import { type DebugSettingsProps, Devtools } from '../types';
64
59
 
@@ -74,6 +69,15 @@ type GraphDebug = {
74
69
  const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${DEBUG_PLUGIN}/space` && isSpace(data.space);
75
70
  const isGraphDebug = (data: any): data is GraphDebug => data?.graph instanceof Graph;
76
71
 
72
+ // TODO(wittjosiah): Factor out?
73
+ const useCurrentSpace = () => {
74
+ const layout = useCapability(Capabilities.Layout);
75
+ const client = useCapability(ClientCapabilities.Client);
76
+ const { spaceId } = parseId(layout.workspace);
77
+ const space = spaceId ? client.spaces.get(spaceId) : undefined;
78
+ return space;
79
+ };
80
+
77
81
  export default (context: PluginsContext) =>
78
82
  contributes(Capabilities.ReactSurface, [
79
83
  createSurface({
@@ -109,12 +113,7 @@ export default (context: PluginsContext) =>
109
113
  [data.subject.space],
110
114
  );
111
115
 
112
- const deprecated = false;
113
- return deprecated ? (
114
- <DebugSpace space={data.subject.space} onAddObjects={handleCreateObject} />
115
- ) : (
116
- <SpaceGenerator space={data.subject.space} onCreateObjects={handleCreateObject} />
117
- );
116
+ return <SpaceGenerator space={data.subject.space} onCreateObjects={handleCreateObject} />;
118
117
  },
119
118
  }),
120
119
  createSurface({
@@ -225,12 +224,13 @@ export default (context: PluginsContext) =>
225
224
  role: 'article',
226
225
  filter: (data): data is any => data.subject === Devtools.Echo.Space,
227
226
  component: () => {
227
+ const space = useCurrentSpace();
228
228
  const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
229
229
  const handleSelect = useCallback(
230
230
  () => dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [Devtools.Echo.Feeds] })),
231
231
  [dispatch],
232
232
  );
233
- return <SpaceInfoPanel onSelectFeed={handleSelect} onSelectPipeline={handleSelect} />;
233
+ return <SpaceInfoPanel space={space} onSelectFeed={handleSelect} onSelectPipeline={handleSelect} />;
234
234
  },
235
235
  }),
236
236
  createSurface({
@@ -243,7 +243,10 @@ export default (context: PluginsContext) =>
243
243
  id: `${DEBUG_PLUGIN}/echo/objects`,
244
244
  role: 'article',
245
245
  filter: (data): data is any => data.subject === Devtools.Echo.Objects,
246
- component: () => <ObjectsPanel />,
246
+ component: () => {
247
+ const space = useCurrentSpace();
248
+ return <ObjectsPanel space={space} />;
249
+ },
247
250
  }),
248
251
  createSurface({
249
252
  id: `${DEBUG_PLUGIN}/echo/automerge`,
@@ -293,12 +296,6 @@ export default (context: PluginsContext) =>
293
296
  filter: (data): data is any => data.subject === Devtools.Agent.Dashboard,
294
297
  component: () => <DashboardPanel />,
295
298
  }),
296
- createSurface({
297
- id: `${DEBUG_PLUGIN}/agent/search`,
298
- role: 'article',
299
- filter: (data): data is any => data.subject === Devtools.Agent.Search,
300
- component: () => <SearchPanel />,
301
- }),
302
299
  createSurface({
303
300
  id: `${DEBUG_PLUGIN}/edge/dashboard`,
304
301
  role: 'article',
@@ -311,4 +308,13 @@ export default (context: PluginsContext) =>
311
308
  filter: (data): data is any => data.subject === Devtools.Edge.Workflows,
312
309
  component: () => <WorkflowPanel />,
313
310
  }),
311
+ createSurface({
312
+ id: `${DEBUG_PLUGIN}/edge/traces`,
313
+ role: 'article',
314
+ filter: (data): data is any => data.subject === Devtools.Edge.Traces,
315
+ component: () => {
316
+ const space = useCurrentSpace();
317
+ return <InvocationTracePanel space={space} />;
318
+ },
319
+ }),
314
320
  ]);
@@ -145,7 +145,7 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
145
145
  }, []);
146
146
 
147
147
  return (
148
- <div role='none' className='flex flex-col divide-y divide-separator'>
148
+ <div role='none' className='flex flex-col divide-y divide-separator overflow-y-auto'>
149
149
  <Toolbar.Root classNames='p-1'>
150
150
  <IconButton icon='ph--arrow-clockwise--regular' iconOnly label='Refresh' onClick={updateInfo} />
151
151
  <IconButton
@@ -5,7 +5,6 @@
5
5
  import { lazy } from 'react';
6
6
 
7
7
  export const DebugApp = lazy(() => import('./DebugApp'));
8
- export const DebugSpace = lazy(() => import('./DebugSpace'));
9
8
  export const SpaceGenerator = lazy(() => import('./SpaceGenerator'));
10
9
 
11
10
  export * from './DebugObjectPanel';
package/src/meta.ts CHANGED
@@ -6,7 +6,7 @@ import { type PluginMeta } from '@dxos/app-framework';
6
6
 
7
7
  export const DEBUG_PLUGIN = 'dxos.org/plugin/debug';
8
8
 
9
- export const meta = {
9
+ export const meta: PluginMeta = {
10
10
  id: DEBUG_PLUGIN,
11
11
  name: 'Debug',
12
12
  description:
@@ -15,4 +15,4 @@ export const meta = {
15
15
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-debug',
16
16
  tags: ['experimental'],
17
17
  screenshots: ['https://dxos.network/plugin-details-debug-dark.png'],
18
- } satisfies PluginMeta;
18
+ };
@@ -60,6 +60,7 @@ export default [
60
60
  'search label': 'Search',
61
61
  'edge label': 'Edge',
62
62
  'workflows label': 'Workflows',
63
+ 'traces label': 'Traces',
63
64
  },
64
65
  },
65
66
  },
package/src/types.ts CHANGED
@@ -78,5 +78,6 @@ export namespace Devtools {
78
78
  export const id = `${Devtools.id}.edge`;
79
79
  export const Dashboard = `${Devtools.Edge.id}.dashboard`;
80
80
  export const Workflows = `${Devtools.Edge.id}.workflows`;
81
+ export const Traces = `${Devtools.Edge.id}.traces`;
81
82
  }
82
83
  }
@@ -1,277 +0,0 @@
1
- import {
2
- Container
3
- } from "./chunk-GSJS3HEM.mjs";
4
- import {
5
- DebugContext
6
- } from "./chunk-Y4ZZEHUN.mjs";
7
-
8
- // packages/plugins/plugin-debug/src/components/DebugSpace/DebugSpace.tsx
9
- import React2, { useContext, useMemo as useMemo2, useState as useState2 } from "react";
10
- import { createSpaceObjectGenerator as createSpaceObjectGenerator2 } from "@dxos/echo-generator";
11
- import { DocumentType } from "@dxos/plugin-markdown/types";
12
- import { Invitation } from "@dxos/protocols/proto/dxos/client/services";
13
- import { faker } from "@dxos/random";
14
- import { useClient } from "@dxos/react-client";
15
- import { Filter, useSpaceInvitation } from "@dxos/react-client/echo";
16
- import { InvitationEncoder } from "@dxos/react-client/invitations";
17
- import { useAsyncEffect } from "@dxos/react-hooks";
18
- import { Icon, IconButton as IconButton2, Input, Toolbar as Toolbar2, useFileDownload } from "@dxos/react-ui";
19
- import { safeParseInt } from "@dxos/util";
20
-
21
- // packages/plugins/plugin-debug/src/components/DebugSpace/ObjectCreator.tsx
22
- import React, { useMemo, useState } from "react";
23
- import { TestSchemaType, createSpaceObjectGenerator } from "@dxos/echo-generator";
24
- import { IconButton, Toolbar } from "@dxos/react-ui";
25
- import { createColumnBuilder, Table } from "@dxos/react-ui-table/deprecated";
26
- var BATCH_SIZE = 10;
27
- var ObjectCreator = ({ space, onAddObjects }) => {
28
- const generator = useMemo(() => createSpaceObjectGenerator(space), [
29
- space
30
- ]);
31
- const [objects, setObjects] = useState(Object.values(TestSchemaType).map((schema) => ({
32
- schema,
33
- enabled: true,
34
- objects: 10,
35
- mutations: {
36
- count: 10,
37
- mutationSize: 10,
38
- maxContentLength: 1e3
39
- }
40
- })));
41
- const handleCreate = async () => {
42
- for (const params of objects) {
43
- if (!params.enabled) {
44
- continue;
45
- }
46
- let objectsCreated = 0;
47
- while (objectsCreated < params.objects) {
48
- const objects2 = await generator.createObjects({
49
- [params.schema]: Math.min(BATCH_SIZE, params.objects - objectsCreated)
50
- });
51
- await generator.mutateObjects(objects2, params.mutations);
52
- objectsCreated += objects2.length;
53
- onAddObjects?.(objects2);
54
- }
55
- }
56
- await space.db.flush();
57
- };
58
- const handleUpdate = (row, key, value) => {
59
- const newObjects = [
60
- ...objects
61
- ];
62
- Object.assign(newObjects.find((object) => object.schema === row.schema), {
63
- [key]: value
64
- });
65
- setObjects(newObjects);
66
- };
67
- const { helper, builder } = createColumnBuilder();
68
- const columns = [
69
- helper.accessor("enabled", builder.switch({
70
- label: "Live",
71
- onUpdate: handleUpdate
72
- })),
73
- helper.accessor("schema", builder.string({
74
- label: "Schema",
75
- classNames: "font-mono"
76
- })),
77
- helper.accessor("objects", builder.number({
78
- label: "Objects",
79
- onUpdate: handleUpdate
80
- })),
81
- helper.accessor((obj) => obj.mutations.count, {
82
- id: "mutations",
83
- ...builder.number({
84
- label: "Mutations",
85
- onUpdate: handleUpdate
86
- })
87
- }),
88
- helper.accessor((obj) => obj.mutations.mutationSize, {
89
- id: "mutationSize",
90
- ...builder.number({
91
- label: "Mut. Size",
92
- onUpdate: handleUpdate
93
- })
94
- }),
95
- helper.accessor((obj) => obj.mutations.maxContentLength, {
96
- id: "mutationMaxContentLength",
97
- ...builder.number({
98
- label: "Length",
99
- onUpdate: handleUpdate
100
- })
101
- })
102
- ];
103
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Table.Root, null, /* @__PURE__ */ React.createElement(Table.Viewport, null, /* @__PURE__ */ React.createElement(Table.Main, {
104
- columns,
105
- data: objects
106
- }))), /* @__PURE__ */ React.createElement(Toolbar.Root, {
107
- classNames: "p-1"
108
- }, /* @__PURE__ */ React.createElement(IconButton, {
109
- icon: "ph--plus--regular",
110
- label: "Create",
111
- onClick: handleCreate
112
- })));
113
- };
114
-
115
- // packages/plugins/plugin-debug/src/components/DebugSpace/DebugSpace.tsx
116
- var DEFAULT_COUNT = 100;
117
- var DEFAULT_PERIOD = 500;
118
- var DEFAULT_JITTER = 50;
119
- var useRefresh = () => {
120
- const [update, setUpdate] = useState2({});
121
- return [
122
- update,
123
- () => setUpdate({})
124
- ];
125
- };
126
- var CustomInput = ({ icon, ...props }) => {
127
- return /* @__PURE__ */ React2.createElement("div", {
128
- role: "none",
129
- className: "relative"
130
- }, /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.TextInput, {
131
- classNames: "w-[100px] text-right pie-[22px]",
132
- size: 5,
133
- ...props
134
- })), /* @__PURE__ */ React2.createElement(Icon, {
135
- icon,
136
- size: 3,
137
- classNames: "absolute inline-end-1 block-start-1 mt-[6px]"
138
- }));
139
- };
140
- var DebugSpace = ({ space, onAddObjects }) => {
141
- const { connect } = useSpaceInvitation(space?.key);
142
- const client = useClient();
143
- const [data, setData] = useState2({});
144
- const [update, handleUpdate] = useRefresh();
145
- useAsyncEffect(async (isMounted) => {
146
- const data2 = await client.diagnostics({
147
- truncate: true
148
- });
149
- if (isMounted()) {
150
- setData(data2?.diagnostics?.spaces?.find(({ key }) => {
151
- return space.key.toHex().startsWith(key);
152
- }));
153
- }
154
- }, [
155
- space,
156
- update
157
- ]);
158
- const download = useFileDownload();
159
- const handleDownload = async () => {
160
- download(new Blob([
161
- JSON.stringify(data, void 0, 2)
162
- ], {
163
- type: "text/plain"
164
- }), `${(/* @__PURE__ */ new Date()).toISOString().replace(/\W/g, "-")}.json`);
165
- };
166
- const [mutationCount, setMutationCount] = useState2(String(DEFAULT_COUNT));
167
- const [mutationInterval, setMutationInterval] = useState2(String(DEFAULT_PERIOD));
168
- const [mutationJitter, setMutationJitter] = useState2(String(DEFAULT_JITTER));
169
- const generator = useMemo2(() => createSpaceObjectGenerator2(space), [
170
- space
171
- ]);
172
- const { running, start, stop } = useContext(DebugContext);
173
- const handleToggleRunning = () => {
174
- if (running) {
175
- stop();
176
- handleUpdate();
177
- } else {
178
- start(async () => {
179
- const { objects } = await space.db.query(Filter.schema(DocumentType)).run();
180
- if (objects.length) {
181
- const object = faker.helpers.arrayElement(objects);
182
- await generator.mutateObject(object, {
183
- count: 10,
184
- mutationSize: 10,
185
- maxContentLength: 1e3
186
- });
187
- }
188
- }, {
189
- count: safeParseInt(mutationCount) ?? 0,
190
- interval: safeParseInt(mutationInterval) ?? 0,
191
- jitter: safeParseInt(mutationJitter) ?? 0
192
- });
193
- }
194
- };
195
- const handleCreateInvitation = () => {
196
- const invitation = space.share({
197
- type: Invitation.Type.INTERACTIVE,
198
- authMethod: Invitation.AuthMethod.NONE,
199
- multiUse: true
200
- });
201
- connect(invitation);
202
- const code = InvitationEncoder.encode(invitation.get());
203
- new URL(window.origin).searchParams.set("spaceInvitationCode", code);
204
- const url = `${window.origin}?spaceInvitationCode=${code}`;
205
- void navigator.clipboard.writeText(url);
206
- };
207
- const handleCreateEpoch = async () => {
208
- await space.internal.createEpoch();
209
- handleUpdate();
210
- };
211
- return /* @__PURE__ */ React2.createElement(Container, {
212
- toolbar: /* @__PURE__ */ React2.createElement(Toolbar2.Root, {
213
- classNames: "p-1"
214
- }, /* @__PURE__ */ React2.createElement(CustomInput, {
215
- icon: "ph--flag--regular",
216
- autoComplete: "off",
217
- placeholder: "Count",
218
- value: mutationCount,
219
- onChange: ({ target: { value } }) => setMutationCount(value)
220
- }), /* @__PURE__ */ React2.createElement(CustomInput, {
221
- icon: "ph--timer--regular",
222
- autoComplete: "off",
223
- placeholder: "Interval",
224
- value: mutationInterval,
225
- onChange: ({ target: { value } }) => setMutationInterval(value)
226
- }), /* @__PURE__ */ React2.createElement(CustomInput, {
227
- icon: "ph--plus-minus--regular",
228
- autoComplete: "off",
229
- placeholder: "Jitter",
230
- value: mutationJitter,
231
- onChange: ({ target: { value } }) => setMutationJitter(value)
232
- }), /* @__PURE__ */ React2.createElement(IconButton2, {
233
- icon: running ? "ph--pause-circle--regular" : "ph--play-circle--regular",
234
- iconOnly: true,
235
- label: "Start/stop",
236
- size: 5,
237
- onClick: handleToggleRunning
238
- }), /* @__PURE__ */ React2.createElement(IconButton2, {
239
- icon: "ph--arrow-clockwise--regular",
240
- iconOnly: true,
241
- label: "Refresh",
242
- size: 5,
243
- onClick: handleUpdate
244
- }), /* @__PURE__ */ React2.createElement(IconButton2, {
245
- icon: "ph--download-simple--regular",
246
- iconOnly: true,
247
- label: "Download",
248
- size: 5,
249
- onClick: handleDownload
250
- }), /* @__PURE__ */ React2.createElement(Toolbar2.Separator, {
251
- variant: "gap"
252
- }), /* @__PURE__ */ React2.createElement(IconButton2, {
253
- icon: "ph--flag-pennant--regular",
254
- iconOnly: true,
255
- label: "Create epoch",
256
- size: 5,
257
- onClick: handleCreateEpoch
258
- }), /* @__PURE__ */ React2.createElement(IconButton2, {
259
- icon: "ph--user-circle-plus--regular",
260
- iconOnly: true,
261
- iconClassNames: "text-blue-500",
262
- label: "Create Invitation",
263
- size: 5,
264
- onClick: handleCreateInvitation
265
- }))
266
- }, /* @__PURE__ */ React2.createElement(ObjectCreator, {
267
- space,
268
- onAddObjects
269
- }));
270
- };
271
-
272
- // packages/plugins/plugin-debug/src/components/DebugSpace/index.ts
273
- var DebugSpace_default = DebugSpace;
274
- export {
275
- DebugSpace_default as default
276
- };
277
- //# sourceMappingURL=DebugSpace-EBJYT5JG.mjs.map