@dxos/plugin-debug 0.8.2-staging.7ac8446 → 0.8.2
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.
- package/dist/lib/browser/DebugApp-WSEJPCKY.mjs +225 -0
- package/dist/lib/browser/{DebugApp-7PFYN52J.mjs.map → DebugApp-WSEJPCKY.mjs.map} +1 -1
- package/dist/lib/browser/DevtoolsOverviewContainer-IIIWO77Q.mjs +25 -0
- package/dist/lib/browser/DevtoolsOverviewContainer-IIIWO77Q.mjs.map +7 -0
- package/dist/lib/browser/{SpaceGenerator-NBOQZ4JF.mjs → SpaceGenerator-RHQLPN44.mjs} +254 -242
- package/dist/lib/browser/SpaceGenerator-RHQLPN44.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-ALFPRSAR.mjs → app-graph-builder-PIPBIN6P.mjs} +115 -88
- package/dist/lib/browser/app-graph-builder-PIPBIN6P.mjs.map +7 -0
- package/dist/lib/browser/{chunk-RORUXVAC.mjs → chunk-47JOZTT2.mjs} +1 -4
- package/dist/lib/browser/{chunk-RORUXVAC.mjs.map → chunk-47JOZTT2.mjs.map} +3 -3
- package/dist/lib/browser/chunk-KS3YBEL7.mjs +68 -0
- package/dist/lib/browser/chunk-KS3YBEL7.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +7 -5
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-context-ZRLN5KUI.mjs → react-context-ZQRD2WG2.mjs} +2 -2
- package/dist/lib/browser/{react-surface-MXXLOQYV.mjs → react-surface-PHUWS5WD.mjs} +318 -288
- package/dist/lib/browser/react-surface-PHUWS5WD.mjs.map +7 -0
- package/dist/lib/browser/{settings-AP74NCXH.mjs → settings-N4Q6YB7L.mjs} +5 -5
- package/dist/lib/browser/settings-N4Q6YB7L.mjs.map +7 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +2 -179
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -178
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/Container.d.ts.map +1 -1
- package/dist/types/src/components/DebugApp/Tree.d.ts.map +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts +2 -2
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/DebugStatus.d.ts.map +1 -1
- package/dist/types/src/components/DevtoolsOverviewContainer.d.ts +4 -0
- package/dist/types/src/components/DevtoolsOverviewContainer.d.ts.map +1 -0
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts +2 -2
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +5 -4
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +60 -53
- package/src/capabilities/app-graph-builder.ts +418 -374
- package/src/capabilities/react-surface.tsx +43 -19
- package/src/capabilities/settings.ts +2 -2
- package/src/components/DebugObjectPanel.tsx +2 -2
- package/src/components/DebugStatus.tsx +4 -29
- package/src/components/DevtoolsOverviewContainer.tsx +20 -0
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +11 -16
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +1 -1
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +9 -9
- package/src/components/SpaceGenerator/presets.ts +20 -18
- package/src/components/Wireframe.tsx +2 -2
- package/src/components/index.ts +1 -0
- package/src/meta.ts +0 -1
- package/src/translations.ts +2 -0
- package/src/types.ts +6 -5
- package/dist/lib/browser/DebugApp-7PFYN52J.mjs +0 -182
- package/dist/lib/browser/SpaceGenerator-NBOQZ4JF.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-ALFPRSAR.mjs.map +0 -7
- package/dist/lib/browser/chunk-TCEHALD4.mjs +0 -73
- package/dist/lib/browser/chunk-TCEHALD4.mjs.map +0 -7
- package/dist/lib/browser/react-surface-MXXLOQYV.mjs.map +0 -7
- package/dist/lib/browser/settings-AP74NCXH.mjs.map +0 -7
- /package/dist/lib/browser/{react-context-ZRLN5KUI.mjs.map → react-context-ZQRD2WG2.mjs.map} +0 -0
|
@@ -13,33 +13,35 @@ import {
|
|
|
13
13
|
createSurface,
|
|
14
14
|
LayoutAction,
|
|
15
15
|
useCapability,
|
|
16
|
-
|
|
16
|
+
useIntentDispatcher,
|
|
17
|
+
type PluginContext,
|
|
17
18
|
} from '@dxos/app-framework';
|
|
18
19
|
import {
|
|
20
|
+
AutomergePanel,
|
|
19
21
|
ConfigPanel,
|
|
20
22
|
CredentialsPanel,
|
|
21
23
|
DeviceListPanel,
|
|
22
24
|
DiagnosticsPanel,
|
|
25
|
+
EdgeDashboardPanel,
|
|
23
26
|
FeedsPanel,
|
|
24
27
|
IdentityPanel,
|
|
28
|
+
InvocationTraceContainer,
|
|
25
29
|
KeyringPanel,
|
|
26
30
|
LoggingPanel,
|
|
27
31
|
MembersPanel,
|
|
28
32
|
MetadataPanel,
|
|
29
33
|
NetworkPanel,
|
|
30
34
|
ObjectsPanel,
|
|
35
|
+
QueuesPanel,
|
|
36
|
+
SchemaPanel,
|
|
31
37
|
SignalPanel,
|
|
32
38
|
SpaceInfoPanel,
|
|
33
39
|
SpaceListPanel,
|
|
34
40
|
StoragePanel,
|
|
35
41
|
SwarmPanel,
|
|
42
|
+
TestingPanel,
|
|
36
43
|
TracingPanel,
|
|
37
|
-
EdgeDashboardPanel,
|
|
38
|
-
AutomergePanel,
|
|
39
44
|
WorkflowPanel,
|
|
40
|
-
QueuesPanel,
|
|
41
|
-
InvocationTracePanel,
|
|
42
|
-
TestingPanel,
|
|
43
45
|
} from '@dxos/devtools';
|
|
44
46
|
import { SettingsStore } from '@dxos/local-storage';
|
|
45
47
|
import { log } from '@dxos/log';
|
|
@@ -51,13 +53,21 @@ import {
|
|
|
51
53
|
SpaceState,
|
|
52
54
|
isSpace,
|
|
53
55
|
isEchoObject,
|
|
54
|
-
type
|
|
55
|
-
type
|
|
56
|
+
type AnyLiveObject,
|
|
57
|
+
type Live,
|
|
56
58
|
type Space,
|
|
57
59
|
parseId,
|
|
58
60
|
} from '@dxos/react-client/echo';
|
|
59
61
|
|
|
60
|
-
import {
|
|
62
|
+
import {
|
|
63
|
+
DebugApp,
|
|
64
|
+
DebugObjectPanel,
|
|
65
|
+
DebugSettings,
|
|
66
|
+
DebugStatus,
|
|
67
|
+
DevtoolsOverviewContainer,
|
|
68
|
+
SpaceGenerator,
|
|
69
|
+
Wireframe,
|
|
70
|
+
} from '../components';
|
|
61
71
|
import { DEBUG_PLUGIN } from '../meta';
|
|
62
72
|
import { type DebugSettingsProps, Devtools } from '../types';
|
|
63
73
|
|
|
@@ -82,7 +92,7 @@ const useCurrentSpace = () => {
|
|
|
82
92
|
return space;
|
|
83
93
|
};
|
|
84
94
|
|
|
85
|
-
export default (context:
|
|
95
|
+
export default (context: PluginContext) =>
|
|
86
96
|
contributes(Capabilities.ReactSurface, [
|
|
87
97
|
createSurface({
|
|
88
98
|
id: `${DEBUG_PLUGIN}/plugin-settings`,
|
|
@@ -97,7 +107,7 @@ export default (context: PluginsContext) =>
|
|
|
97
107
|
filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),
|
|
98
108
|
component: ({ data }) => {
|
|
99
109
|
const handleCreateObject = useCallback(
|
|
100
|
-
(objects:
|
|
110
|
+
(objects: Live<any>[]) => {
|
|
101
111
|
if (!isSpace(data.subject.space)) {
|
|
102
112
|
return;
|
|
103
113
|
}
|
|
@@ -109,7 +119,7 @@ export default (context: PluginsContext) =>
|
|
|
109
119
|
return;
|
|
110
120
|
}
|
|
111
121
|
|
|
112
|
-
const { dispatchPromise: dispatch } =
|
|
122
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
113
123
|
objects.forEach((object) => {
|
|
114
124
|
void dispatch(createIntent(SpaceAction.AddObject, { target: collection, object }));
|
|
115
125
|
});
|
|
@@ -130,9 +140,9 @@ export default (context: PluginsContext) =>
|
|
|
130
140
|
id: `${DEBUG_PLUGIN}/wireframe`,
|
|
131
141
|
role: ['article', 'section'],
|
|
132
142
|
position: 'hoist',
|
|
133
|
-
filter: (data): data is { subject:
|
|
143
|
+
filter: (data): data is { subject: AnyLiveObject<any> } => {
|
|
134
144
|
const settings = context
|
|
135
|
-
.
|
|
145
|
+
.getCapability(Capabilities.SettingsStore)
|
|
136
146
|
.getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;
|
|
137
147
|
return isEchoObject(data.subject) && !!settings.wireframe;
|
|
138
148
|
},
|
|
@@ -143,10 +153,15 @@ export default (context: PluginsContext) =>
|
|
|
143
153
|
createSurface({
|
|
144
154
|
id: `${DEBUG_PLUGIN}/object-debug`,
|
|
145
155
|
role: 'article',
|
|
146
|
-
filter: (data): data is { companionTo:
|
|
156
|
+
filter: (data): data is { companionTo: AnyLiveObject<any> } =>
|
|
147
157
|
data.subject === 'debug' && isEchoObject(data.companionTo),
|
|
148
158
|
component: ({ data }) => <DebugObjectPanel object={data.companionTo} />,
|
|
149
159
|
}),
|
|
160
|
+
createSurface({
|
|
161
|
+
id: `${DEBUG_PLUGIN}/devtools-overview`,
|
|
162
|
+
role: 'deck-companion--devtools',
|
|
163
|
+
component: () => <DevtoolsOverviewContainer />,
|
|
164
|
+
}),
|
|
150
165
|
createSurface({
|
|
151
166
|
id: `${DEBUG_PLUGIN}/status`,
|
|
152
167
|
role: 'status',
|
|
@@ -219,7 +234,7 @@ export default (context: PluginsContext) =>
|
|
|
219
234
|
role: 'article',
|
|
220
235
|
filter: (data): data is any => data.subject === Devtools.Echo.Spaces,
|
|
221
236
|
component: () => {
|
|
222
|
-
const { dispatchPromise: dispatch } =
|
|
237
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
223
238
|
const handleSelect = useCallback(
|
|
224
239
|
() => dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [Devtools.Echo.Space] })),
|
|
225
240
|
[dispatch],
|
|
@@ -233,7 +248,7 @@ export default (context: PluginsContext) =>
|
|
|
233
248
|
filter: (data): data is any => data.subject === Devtools.Echo.Space,
|
|
234
249
|
component: () => {
|
|
235
250
|
const space = useCurrentSpace();
|
|
236
|
-
const { dispatchPromise: dispatch } =
|
|
251
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
237
252
|
const handleSelect = useCallback(
|
|
238
253
|
() => dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [Devtools.Echo.Feeds] })),
|
|
239
254
|
[dispatch],
|
|
@@ -259,6 +274,15 @@ export default (context: PluginsContext) =>
|
|
|
259
274
|
return <ObjectsPanel space={space} />;
|
|
260
275
|
},
|
|
261
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
|
+
}),
|
|
262
286
|
createSurface({
|
|
263
287
|
id: `${DEBUG_PLUGIN}/echo/automerge`,
|
|
264
288
|
role: 'article',
|
|
@@ -338,7 +362,7 @@ export default (context: PluginsContext) =>
|
|
|
338
362
|
filter: (data): data is any => data.subject === Devtools.Edge.Traces,
|
|
339
363
|
component: () => {
|
|
340
364
|
const space = useCurrentSpace();
|
|
341
|
-
return <
|
|
365
|
+
return <InvocationTraceContainer space={space} />;
|
|
342
366
|
},
|
|
343
367
|
}),
|
|
344
368
|
createSurface({
|
|
@@ -346,7 +370,7 @@ export default (context: PluginsContext) =>
|
|
|
346
370
|
role: 'article',
|
|
347
371
|
filter: (data): data is any => data.subject === Devtools.Edge.Testing,
|
|
348
372
|
component: () => {
|
|
349
|
-
const { dispatchPromise: dispatch } =
|
|
373
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
350
374
|
const onSpaceCreate = useCallback(
|
|
351
375
|
async (space: Space) => {
|
|
352
376
|
await space.waitUntilReady();
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Capabilities, contributes } from '@dxos/app-framework';
|
|
6
|
-
import {
|
|
6
|
+
import { live } from '@dxos/react-client/echo';
|
|
7
7
|
|
|
8
8
|
import { DEBUG_PLUGIN } from '../meta';
|
|
9
9
|
import { type DebugSettingsProps, DebugSettingsSchema } from '../types';
|
|
10
10
|
|
|
11
11
|
export default () => {
|
|
12
|
-
const settings =
|
|
12
|
+
const settings = live<DebugSettingsProps>({});
|
|
13
13
|
|
|
14
14
|
return contributes(Capabilities.Settings, { schema: DebugSettingsSchema, prefix: DEBUG_PLUGIN, value: settings });
|
|
15
15
|
};
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type AnyLiveObject } from '@dxos/client/echo';
|
|
8
8
|
import { Clipboard, Input } from '@dxos/react-ui';
|
|
9
9
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
10
10
|
|
|
11
11
|
export type DebugObjectPanelProps = {
|
|
12
|
-
object:
|
|
12
|
+
object: AnyLiveObject<any>;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
// TODO(burdon): Get schema and traverse references.
|
|
@@ -4,14 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useEffect, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { useAppGraph, useLayout } from '@dxos/app-framework';
|
|
8
7
|
import { TimeoutError } from '@dxos/async';
|
|
9
|
-
import {
|
|
10
|
-
import { getActiveSpace } from '@dxos/plugin-space';
|
|
8
|
+
import { useActiveSpace } from '@dxos/plugin-space';
|
|
11
9
|
import { StatusBar } from '@dxos/plugin-status-bar';
|
|
12
10
|
import { ConnectionState } from '@dxos/protocols/proto/dxos/client/services';
|
|
13
11
|
import { useNetworkStatus } from '@dxos/react-client/mesh';
|
|
14
|
-
import { Icon
|
|
12
|
+
import { Icon } from '@dxos/react-ui';
|
|
15
13
|
|
|
16
14
|
const styles = {
|
|
17
15
|
success: 'text-sky-300 dark:text-green-700',
|
|
@@ -135,9 +133,7 @@ const SwarmIndicator = () => {
|
|
|
135
133
|
// TODO(burdon): Merge with SaveStatus.
|
|
136
134
|
const SavingIndicator = () => {
|
|
137
135
|
const [state, _setState] = useState(0);
|
|
138
|
-
const
|
|
139
|
-
const { graph } = useAppGraph();
|
|
140
|
-
const _space = graph ? getActiveSpace(graph, layout.active[0]) : undefined;
|
|
136
|
+
const _space = useActiveSpace();
|
|
141
137
|
// TODO(dmaretskyi): Fix this when we have save status for automerge.
|
|
142
138
|
// useEffect(() => {
|
|
143
139
|
// if (!space) {
|
|
@@ -180,28 +176,7 @@ const SavingIndicator = () => {
|
|
|
180
176
|
}
|
|
181
177
|
};
|
|
182
178
|
|
|
183
|
-
const
|
|
184
|
-
const [visible, setVisible] = useState(false);
|
|
185
|
-
const [stats, refreshStats] = useStats();
|
|
186
|
-
|
|
187
|
-
return (
|
|
188
|
-
<Popover.Root open={visible} onOpenChange={setVisible}>
|
|
189
|
-
<Popover.Trigger asChild>
|
|
190
|
-
<StatusBar.Button onClick={() => setVisible((visible) => !visible)} title='Performance panels'>
|
|
191
|
-
<Icon icon='ph--chart-bar--regular' size={4} />
|
|
192
|
-
</StatusBar.Button>
|
|
193
|
-
</Popover.Trigger>
|
|
194
|
-
<Popover.Portal>
|
|
195
|
-
<Popover.Content classNames='max-is-[min(var(--radix-popover-content-available-width),300px)] max-bs-[--radix-popover-content-available-height]'>
|
|
196
|
-
<StatsPanel stats={stats} onRefresh={refreshStats} />
|
|
197
|
-
<Popover.Arrow />
|
|
198
|
-
</Popover.Content>
|
|
199
|
-
</Popover.Portal>
|
|
200
|
-
</Popover.Root>
|
|
201
|
-
);
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
const indicators = [SavingIndicator, SwarmIndicator, PerformanceIndicator, ErrorIndicator];
|
|
179
|
+
const indicators = [SavingIndicator, SwarmIndicator, ErrorIndicator];
|
|
205
180
|
|
|
206
181
|
export const DebugStatus = () => {
|
|
207
182
|
return (
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { Surface } from '@dxos/app-framework';
|
|
8
|
+
import { StatsPanel, useStats } from '@dxos/devtools';
|
|
9
|
+
|
|
10
|
+
export const DevtoolsOverviewContainer = () => {
|
|
11
|
+
const [stats, refreshStats] = useStats();
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<StatsPanel stats={stats} onRefresh={refreshStats}>
|
|
15
|
+
<Surface role='devtools-overview' />
|
|
16
|
+
</StatsPanel>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default DevtoolsOverviewContainer;
|
|
@@ -6,7 +6,7 @@ import { addressToA1Notation } from '@dxos/compute';
|
|
|
6
6
|
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from '@dxos/conductor';
|
|
7
7
|
import { ObjectId, type BaseObject, type TypedObject } from '@dxos/echo-schema';
|
|
8
8
|
import { DXN } from '@dxos/keys';
|
|
9
|
-
import {
|
|
9
|
+
import { live, makeRef, type Live } from '@dxos/live-object';
|
|
10
10
|
import { DocumentType } from '@dxos/plugin-markdown/types';
|
|
11
11
|
import { createSheet } from '@dxos/plugin-sheet/types';
|
|
12
12
|
import { SheetType, type CellValue } from '@dxos/plugin-sheet/types';
|
|
@@ -14,7 +14,7 @@ import { CanvasType, DiagramType } from '@dxos/plugin-sketch/types';
|
|
|
14
14
|
import { faker } from '@dxos/random';
|
|
15
15
|
import { Filter, type Space } from '@dxos/react-client/echo';
|
|
16
16
|
import { TableType } from '@dxos/react-ui-table';
|
|
17
|
-
import { createView,
|
|
17
|
+
import { createView, DataType } from '@dxos/schema';
|
|
18
18
|
import { createAsyncGenerator, type ValueGenerator } from '@dxos/schema/testing';
|
|
19
19
|
import { range } from '@dxos/util';
|
|
20
20
|
|
|
@@ -31,8 +31,8 @@ const generator: ValueGenerator = faker as any;
|
|
|
31
31
|
export type ObjectGenerator<T extends BaseObject> = (
|
|
32
32
|
space: Space,
|
|
33
33
|
n: number,
|
|
34
|
-
cb?: (objects:
|
|
35
|
-
) => Promise<
|
|
34
|
+
cb?: (objects: Live<any>[]) => void,
|
|
35
|
+
) => Promise<Live<T>[]>;
|
|
36
36
|
|
|
37
37
|
export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
38
38
|
[
|
|
@@ -40,10 +40,9 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
40
40
|
async (space, n, cb) => {
|
|
41
41
|
const objects = range(n).map(() => {
|
|
42
42
|
return space.db.add(
|
|
43
|
-
|
|
43
|
+
live(DocumentType, {
|
|
44
44
|
name: faker.commerce.productName(),
|
|
45
|
-
content: makeRef(
|
|
46
|
-
threads: [],
|
|
45
|
+
content: makeRef(live(DataType.Text, { content: faker.lorem.sentences(5) })),
|
|
47
46
|
}),
|
|
48
47
|
);
|
|
49
48
|
});
|
|
@@ -58,9 +57,9 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
58
57
|
const objects = range(n).map(() => {
|
|
59
58
|
// TODO(burdon): Generate diagram.
|
|
60
59
|
const obj = space.db.add(
|
|
61
|
-
|
|
60
|
+
live(DiagramType, {
|
|
62
61
|
name: faker.commerce.productName(),
|
|
63
|
-
canvas: makeRef(
|
|
62
|
+
canvas: makeRef(live(CanvasType, { content: {} })),
|
|
64
63
|
}),
|
|
65
64
|
);
|
|
66
65
|
|
|
@@ -139,11 +138,7 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
139
138
|
]);
|
|
140
139
|
|
|
141
140
|
export const createGenerator = <T extends BaseObject>(type: TypedObject<T>): ObjectGenerator<T> => {
|
|
142
|
-
return async (
|
|
143
|
-
space: Space,
|
|
144
|
-
n: number,
|
|
145
|
-
cb?: (objects: ReactiveObject<any>[]) => void,
|
|
146
|
-
): Promise<ReactiveObject<T>[]> => {
|
|
141
|
+
return async (space: Space, n: number, cb?: (objects: Live<any>[]) => void): Promise<Live<T>[]> => {
|
|
147
142
|
// Find or create mutable schema.
|
|
148
143
|
const schema =
|
|
149
144
|
(await space.db.schemaRegistry.query({ typename: type.typename }).firstOrUndefined()) ??
|
|
@@ -154,12 +149,12 @@ export const createGenerator = <T extends BaseObject>(type: TypedObject<T>): Obj
|
|
|
154
149
|
const objects = await generate.createObjects(n);
|
|
155
150
|
|
|
156
151
|
// Find or create table and view.
|
|
157
|
-
const { objects: tables } = await space.db.query(Filter.
|
|
152
|
+
const { objects: tables } = await space.db.query(Filter.type(TableType)).run();
|
|
158
153
|
const table = tables.find((table) => table.view?.target?.query?.typename === type.typename);
|
|
159
154
|
if (!table) {
|
|
160
155
|
const name = type.typename.split('/').pop() ?? type.typename;
|
|
161
156
|
const view = createView({ name, typename: type.typename, jsonSchema: schema.jsonSchema });
|
|
162
|
-
const table = space.db.add(
|
|
157
|
+
const table = space.db.add(live(TableType, { name, view: makeRef(view) }));
|
|
163
158
|
cb?.([table]);
|
|
164
159
|
}
|
|
165
160
|
|
|
@@ -26,7 +26,7 @@ const meta: Meta = {
|
|
|
26
26
|
title: 'plugins/plugin-debug/SpaceGenerator',
|
|
27
27
|
component: SpaceGenerator,
|
|
28
28
|
render: render(DefaultStory),
|
|
29
|
-
decorators: [withClientProvider({ createSpace: true }), withLayout(
|
|
29
|
+
decorators: [withClientProvider({ createSpace: true }), withLayout(), withTheme],
|
|
30
30
|
parameters: {
|
|
31
31
|
layout: 'fullscreen',
|
|
32
32
|
},
|
|
@@ -6,8 +6,8 @@ import React, { useCallback, useMemo, useState } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { ComputeGraph } from '@dxos/conductor';
|
|
9
|
-
import { toEffectSchema } from '@dxos/echo-schema';
|
|
10
|
-
import {
|
|
9
|
+
import { Filter, toEffectSchema } from '@dxos/echo-schema';
|
|
10
|
+
import { live, type Live } from '@dxos/live-object';
|
|
11
11
|
import { log } from '@dxos/log';
|
|
12
12
|
import { DocumentType } from '@dxos/plugin-markdown/types';
|
|
13
13
|
import { SheetType } from '@dxos/plugin-sheet/types';
|
|
@@ -18,23 +18,23 @@ import { getTypename, type Space } from '@dxos/react-client/echo';
|
|
|
18
18
|
import { IconButton, Input, Toolbar, useAsyncEffect } from '@dxos/react-ui';
|
|
19
19
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
20
20
|
import { initializeTable, TableType } from '@dxos/react-ui-table';
|
|
21
|
-
import {
|
|
21
|
+
import { DataType } from '@dxos/schema';
|
|
22
22
|
import { jsonKeyReplacer, sortKeys } from '@dxos/util';
|
|
23
23
|
|
|
24
|
-
import {
|
|
24
|
+
import { createGenerator, staticGenerators, type ObjectGenerator } from './ObjectGenerator';
|
|
25
25
|
import { SchemaTable } from './SchemaTable';
|
|
26
26
|
import { presets } from './presets';
|
|
27
27
|
|
|
28
28
|
export type SpaceGeneratorProps = {
|
|
29
29
|
space: Space;
|
|
30
|
-
onCreateObjects?: (objects:
|
|
30
|
+
onCreateObjects?: (objects: Live<any>[]) => void;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps) => {
|
|
34
34
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
35
35
|
const client = useClient();
|
|
36
36
|
const staticTypes = [DocumentType, DiagramType, SheetType, ComputeGraph]; // TODO(burdon): Make extensible.
|
|
37
|
-
const mutableTypes = [
|
|
37
|
+
const mutableTypes = [DataType.Organization, DataType.Project, DataType.Person, DataType.Message];
|
|
38
38
|
const [count, setCount] = useState(1);
|
|
39
39
|
const [info, setInfo] = useState<any>({});
|
|
40
40
|
|
|
@@ -55,7 +55,7 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
|
|
|
55
55
|
const staticSchema = space.db.graph.schemaRegistry.schemas;
|
|
56
56
|
|
|
57
57
|
// Create object map.
|
|
58
|
-
const { objects } = await space.db.query().run();
|
|
58
|
+
const { objects } = await space.db.query(Filter.everything()).run();
|
|
59
59
|
const objectMap = sortKeys(
|
|
60
60
|
objects.reduce<Record<string, number>>((map, obj) => {
|
|
61
61
|
const type = getTypename(obj);
|
|
@@ -111,7 +111,7 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
|
|
|
111
111
|
schemas.map(async (schema) => {
|
|
112
112
|
const parts = schema.typename.split('/');
|
|
113
113
|
const name = parts[parts.length - 1];
|
|
114
|
-
const table =
|
|
114
|
+
const table = live(TableType, { name, threads: [] });
|
|
115
115
|
await initializeTable({ client, space, table, typename: schema.typename });
|
|
116
116
|
await dispatch(createIntent(SpaceAction.AddObject, { target: space, object: table }));
|
|
117
117
|
return table;
|
|
@@ -125,7 +125,7 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
|
|
|
125
125
|
log.warn('Missing schema for object', { id, typename });
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
|
-
const object =
|
|
128
|
+
const object = live(schema, fields);
|
|
129
129
|
space.db.add(object);
|
|
130
130
|
return object;
|
|
131
131
|
}),
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import {
|
|
5
|
+
import { Schema, SchemaAST } from 'effect';
|
|
6
|
+
|
|
7
|
+
import { type ComputeGraphModel, NODE_INPUT } from '@dxos/conductor';
|
|
8
|
+
import { Ref } from '@dxos/echo';
|
|
9
|
+
import { ObjectId, toJsonSchema } from '@dxos/echo-schema';
|
|
10
|
+
import { FunctionTrigger, TriggerKind, EmailTriggerOutput, type TriggerType } from '@dxos/functions';
|
|
8
11
|
import { invariant } from '@dxos/invariant';
|
|
9
12
|
import { DXN } from '@dxos/keys';
|
|
10
|
-
import {
|
|
13
|
+
import { live, makeRef } from '@dxos/live-object';
|
|
11
14
|
import { Filter, type Space } from '@dxos/react-client/echo';
|
|
12
15
|
import {
|
|
13
16
|
type ComputeShape,
|
|
@@ -131,7 +134,7 @@ export const presets = {
|
|
|
131
134
|
const objects = range(n, () => {
|
|
132
135
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
133
136
|
|
|
134
|
-
const results = space.db.query(Filter.
|
|
137
|
+
const results = space.db.query(Filter.type(TableType)).runSync();
|
|
135
138
|
const emailTable = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Email'));
|
|
136
139
|
invariant(emailTable, 'Email table not found.');
|
|
137
140
|
|
|
@@ -161,7 +164,7 @@ export const presets = {
|
|
|
161
164
|
|
|
162
165
|
const appendToTable = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
|
|
163
166
|
|
|
164
|
-
const properties =
|
|
167
|
+
const properties = SchemaAST.getPropertySignatures(EmailTriggerOutput.ast);
|
|
165
168
|
for (let i = 0; i < properties.length; i++) {
|
|
166
169
|
const propName = properties[i].name.toString();
|
|
167
170
|
builder.createEdge({ source: trigger.id, target: template.id, input: propName, output: propName });
|
|
@@ -228,7 +231,7 @@ export const presets = {
|
|
|
228
231
|
const objects = range(n, () => {
|
|
229
232
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
230
233
|
|
|
231
|
-
const results = space.db.query(Filter.
|
|
234
|
+
const results = space.db.query(Filter.type(TableType)).runSync();
|
|
232
235
|
const emailTable = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Email'));
|
|
233
236
|
invariant(emailTable, 'Email table not found.');
|
|
234
237
|
|
|
@@ -280,7 +283,7 @@ export const presets = {
|
|
|
280
283
|
templateContent.push(' "category": "{{text}}",');
|
|
281
284
|
builder.createEdge({ source: gpt.id, target: template.id, input: 'text', output: 'text' });
|
|
282
285
|
|
|
283
|
-
const properties =
|
|
286
|
+
const properties = SchemaAST.getPropertySignatures(EmailTriggerOutput.ast);
|
|
284
287
|
for (let i = 0; i < properties.length; i++) {
|
|
285
288
|
const propName = properties[i].name.toString();
|
|
286
289
|
builder.createEdge({ source: trigger.id, target: template.id, input: propName, output: propName });
|
|
@@ -304,7 +307,7 @@ export const presets = {
|
|
|
304
307
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
305
308
|
invariant(templateComputeNode, 'Template compute node was not created.');
|
|
306
309
|
templateComputeNode.value = templateContent.join('\n');
|
|
307
|
-
const extendedSchema =
|
|
310
|
+
const extendedSchema = Schema.extend(EmailTriggerOutput, Schema.Struct({ text: Schema.String }));
|
|
308
311
|
templateComputeNode.inputSchema = toJsonSchema(extendedSchema);
|
|
309
312
|
|
|
310
313
|
attachTrigger(functionTrigger, computeModel);
|
|
@@ -402,11 +405,11 @@ export const presets = {
|
|
|
402
405
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
403
406
|
|
|
404
407
|
// TODO(wittjosiah): Integrate directly w/ Kanban.
|
|
405
|
-
// const results = space.db.query(Filter.
|
|
408
|
+
// const results = space.db.query(Filter.type(KanbanType)).runSync();
|
|
406
409
|
// const kanban = results.find((r) => r.object?.cardView?.target?.query?.type?.endsWith('Message'));
|
|
407
410
|
// invariant(kanban, 'Kanban not found.');
|
|
408
411
|
|
|
409
|
-
const results = space.db.query(Filter.
|
|
412
|
+
const results = space.db.query(Filter.type(TableType)).runSync();
|
|
410
413
|
const messages = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Message'));
|
|
411
414
|
invariant(messages, 'Table not found.');
|
|
412
415
|
|
|
@@ -449,7 +452,7 @@ export const presets = {
|
|
|
449
452
|
const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
450
453
|
space: Space,
|
|
451
454
|
triggerKind: SpecType,
|
|
452
|
-
initSpec: (spec: Extract<TriggerType, {
|
|
455
|
+
initSpec: (spec: Extract<TriggerType, { kind: SpecType }>) => void,
|
|
453
456
|
triggerOutputName: string,
|
|
454
457
|
) => {
|
|
455
458
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
@@ -491,7 +494,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
491
494
|
|
|
492
495
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
493
496
|
const triggerSpec = functionTrigger.spec;
|
|
494
|
-
invariant(triggerSpec && triggerSpec.
|
|
497
|
+
invariant(triggerSpec && triggerSpec.kind === triggerKind, 'No trigger spec.');
|
|
495
498
|
initSpec(triggerSpec as any);
|
|
496
499
|
});
|
|
497
500
|
|
|
@@ -500,7 +503,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
500
503
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
501
504
|
invariant(templateComputeNode, 'Template compute node was not created.');
|
|
502
505
|
templateComputeNode.value = ['{', ' "@type": "{{type}}",', ' "id": "@{{changeId}}"', '}'].join('\n');
|
|
503
|
-
templateComputeNode.inputSchema = toJsonSchema(
|
|
506
|
+
templateComputeNode.inputSchema = toJsonSchema(Schema.Struct({ type: Schema.String, changeId: Schema.String }));
|
|
504
507
|
|
|
505
508
|
attachTrigger(functionTrigger, computeModel);
|
|
506
509
|
|
|
@@ -509,7 +512,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
509
512
|
|
|
510
513
|
const addToSpace = (name: string, space: Space, canvas: CanvasGraphModel, compute: ComputeGraphModel) => {
|
|
511
514
|
return space.db.add(
|
|
512
|
-
|
|
515
|
+
live(CanvasBoardType, {
|
|
513
516
|
name,
|
|
514
517
|
computeGraph: makeRef(compute.root),
|
|
515
518
|
layout: canvas.graph,
|
|
@@ -539,10 +542,9 @@ const setupQueue = (
|
|
|
539
542
|
|
|
540
543
|
const attachTrigger = (functionTrigger: FunctionTrigger | undefined, computeModel: ComputeGraphModel) => {
|
|
541
544
|
invariant(functionTrigger);
|
|
542
|
-
functionTrigger.function =
|
|
543
|
-
functionTrigger.meta ??= {};
|
|
545
|
+
functionTrigger.function = Ref.make(computeModel.root);
|
|
544
546
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
|
|
545
|
-
functionTrigger.
|
|
547
|
+
functionTrigger.inputNodeId = inputNode.id;
|
|
546
548
|
};
|
|
547
549
|
|
|
548
550
|
type RawPositionInput = { centerX: number; centerY: number; width: number; height: number };
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { useResizeDetector } from 'react-resize-detector';
|
|
7
7
|
|
|
8
|
-
import { fullyQualifiedId, type
|
|
8
|
+
import { fullyQualifiedId, type AnyLiveObject } from '@dxos/react-client/echo';
|
|
9
9
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
10
10
|
import { useAttendableAttributes } from '@dxos/react-ui-attention';
|
|
11
11
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
@@ -14,7 +14,7 @@ import { mx } from '@dxos/react-ui-theme';
|
|
|
14
14
|
// TODO(burdon): Create generic container with wireframe mode.
|
|
15
15
|
export type WireframeProps = ThemedClassName<{
|
|
16
16
|
label?: string;
|
|
17
|
-
object:
|
|
17
|
+
object: AnyLiveObject<any>;
|
|
18
18
|
}>;
|
|
19
19
|
|
|
20
20
|
// TODO(burdon): Make focusable and attendable with input.
|
package/src/components/index.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { lazy } from 'react';
|
|
6
6
|
|
|
7
7
|
export const DebugApp = lazy(() => import('./DebugApp'));
|
|
8
|
+
export const DevtoolsOverviewContainer = lazy(() => import('./DevtoolsOverviewContainer'));
|
|
8
9
|
export const SpaceGenerator = lazy(() => import('./SpaceGenerator'));
|
|
9
10
|
|
|
10
11
|
export * from './DebugObjectPanel';
|
package/src/meta.ts
CHANGED
|
@@ -13,6 +13,5 @@ export const meta: PluginMeta = {
|
|
|
13
13
|
'The debug plugin is useful for troubleshooting inside of Composer. You can also use the Debug plugin to create test data inside of sheets or tables or explore pre-built automations. Non-technical users will likely not spend much time here, but this plugin is invaluable for developers and technical users.',
|
|
14
14
|
icon: 'ph--bug--regular',
|
|
15
15
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-debug',
|
|
16
|
-
tags: ['experimental'],
|
|
17
16
|
screenshots: ['https://dxos.network/plugin-details-debug-dark.png'],
|
|
18
17
|
};
|
package/src/translations.ts
CHANGED
|
@@ -13,6 +13,7 @@ export default [
|
|
|
13
13
|
'mutation period': 'Mutation period',
|
|
14
14
|
'open devtools label': 'Open DevTools',
|
|
15
15
|
'devtools label': 'DevTools',
|
|
16
|
+
'devtools overview label': 'DevTools Stats',
|
|
16
17
|
'debug label': 'Debug',
|
|
17
18
|
'settings show debug panel': 'Show Debug panel.',
|
|
18
19
|
'settings show devtools panel': 'Show DevTools panel.',
|
|
@@ -47,6 +48,7 @@ export default [
|
|
|
47
48
|
'space label': 'Space',
|
|
48
49
|
'feeds label': 'Feeds',
|
|
49
50
|
'objects label': 'Objects',
|
|
51
|
+
'schema label': 'Schema',
|
|
50
52
|
'automerge label': 'Automerge',
|
|
51
53
|
'queues label': 'Queues',
|
|
52
54
|
'members label': 'Members',
|
package/src/types.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import { type Context, createContext } from 'react';
|
|
6
7
|
|
|
7
8
|
import type { TimerCallback, TimerOptions } from '@dxos/async';
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
9
9
|
|
|
10
10
|
export type DebugContextType = {
|
|
11
11
|
running: boolean;
|
|
@@ -19,13 +19,13 @@ export const DebugContext: Context<DebugContextType> = createContext<DebugContex
|
|
|
19
19
|
stop: () => {},
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
export const DebugSettingsSchema =
|
|
23
|
-
|
|
24
|
-
wireframe:
|
|
22
|
+
export const DebugSettingsSchema = Schema.mutable(
|
|
23
|
+
Schema.Struct({
|
|
24
|
+
wireframe: Schema.optional(Schema.Boolean),
|
|
25
25
|
}),
|
|
26
26
|
);
|
|
27
27
|
|
|
28
|
-
export interface DebugSettingsProps extends
|
|
28
|
+
export interface DebugSettingsProps extends Schema.Schema.Type<typeof DebugSettingsSchema> {}
|
|
29
29
|
|
|
30
30
|
export namespace Devtools {
|
|
31
31
|
// TODO(wittjosiah): Cannot use slashes in ids until we have a router which decouples ids from url paths.
|
|
@@ -54,6 +54,7 @@ export namespace Devtools {
|
|
|
54
54
|
export const Space = `${Devtools.Echo.id}.space`;
|
|
55
55
|
export const Feeds = `${Devtools.Echo.id}.feeds`;
|
|
56
56
|
export const Objects = `${Devtools.Echo.id}.objects`;
|
|
57
|
+
export const Schema = `${Devtools.Echo.id}.schema`;
|
|
57
58
|
export const Automerge = `${Devtools.Echo.id}.automerge`;
|
|
58
59
|
export const Queues = `${Devtools.Echo.id}.queues`;
|
|
59
60
|
export const Members = `${Devtools.Echo.id}.members`;
|