@dxos/plugin-debug 0.8.1-staging.391c573 → 0.8.1-staging.9eaf14f
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-LQHFFK3Y.mjs → DebugApp-7PFYN52J.mjs} +30 -23
- package/dist/lib/browser/{DebugApp-LQHFFK3Y.mjs.map → DebugApp-7PFYN52J.mjs.map} +4 -4
- package/dist/lib/browser/{SpaceGenerator-SPEJBGP7.mjs → SpaceGenerator-NBOQZ4JF.mjs} +12 -12
- package/dist/lib/browser/SpaceGenerator-NBOQZ4JF.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-ALFPRSAR.mjs +570 -0
- package/dist/lib/browser/app-graph-builder-ALFPRSAR.mjs.map +7 -0
- package/dist/lib/browser/{chunk-EF3UVAVI.mjs → chunk-RORUXVAC.mjs} +1 -1
- package/dist/lib/browser/chunk-RORUXVAC.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LHJC7LSH.mjs → chunk-TCEHALD4.mjs} +2 -3
- package/dist/lib/browser/chunk-TCEHALD4.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +9 -25
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-context-TCD3MNIT.mjs → react-context-ZRLN5KUI.mjs} +2 -2
- package/dist/lib/browser/{react-surface-PQFKDW3V.mjs → react-surface-MXXLOQYV.mjs} +110 -44
- package/dist/lib/browser/react-surface-MXXLOQYV.mjs.map +7 -0
- package/dist/lib/browser/{settings-DLIPIUG7.mjs → settings-AP74NCXH.mjs} +6 -8
- package/dist/lib/browser/{settings-DLIPIUG7.mjs.map → settings-AP74NCXH.mjs.map} +3 -3
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -9
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +49 -48
- package/src/DebugPlugin.tsx +1 -14
- package/src/capabilities/app-graph-builder.ts +329 -357
- package/src/capabilities/react-surface.tsx +75 -41
- package/src/capabilities/settings.ts +1 -3
- package/src/components/DebugSettings.tsx +0 -3
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +1 -1
- package/src/components/SpaceGenerator/SchemaTable.tsx +1 -1
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +3 -9
- package/src/components/index.ts +0 -1
- package/src/meta.ts +2 -2
- package/src/translations.ts +3 -2
- package/src/types.ts +1 -1
- package/dist/lib/browser/DebugSpace-5A2QOKAZ.mjs +0 -277
- package/dist/lib/browser/DebugSpace-5A2QOKAZ.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-SPEJBGP7.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-NYB6QZQK.mjs +0 -619
- package/dist/lib/browser/app-graph-builder-NYB6QZQK.mjs.map +0 -7
- package/dist/lib/browser/chunk-EF3UVAVI.mjs.map +0 -7
- package/dist/lib/browser/chunk-GSJS3HEM.mjs +0 -15
- package/dist/lib/browser/chunk-GSJS3HEM.mjs.map +0 -7
- package/dist/lib/browser/chunk-LHJC7LSH.mjs.map +0 -7
- package/dist/lib/browser/react-surface-PQFKDW3V.mjs.map +0 -7
- package/dist/types/src/components/DebugSpace/DebugSpace.d.ts +0 -8
- package/dist/types/src/components/DebugSpace/DebugSpace.d.ts.map +0 -1
- package/dist/types/src/components/DebugSpace/DebugSpace.stories.d.ts +0 -6
- package/dist/types/src/components/DebugSpace/DebugSpace.stories.d.ts.map +0 -1
- package/dist/types/src/components/DebugSpace/ObjectCreator.d.ts +0 -15
- package/dist/types/src/components/DebugSpace/ObjectCreator.d.ts.map +0 -1
- package/dist/types/src/components/DebugSpace/ObjectCreator.stories.d.ts +0 -6
- package/dist/types/src/components/DebugSpace/ObjectCreator.stories.d.ts.map +0 -1
- package/dist/types/src/components/DebugSpace/index.d.ts +0 -3
- package/dist/types/src/components/DebugSpace/index.d.ts.map +0 -1
- package/src/components/DebugSpace/DebugSpace.stories.tsx +0 -46
- package/src/components/DebugSpace/DebugSpace.tsx +0 -183
- package/src/components/DebugSpace/ObjectCreator.stories.tsx +0 -51
- package/src/components/DebugSpace/ObjectCreator.tsx +0 -100
- package/src/components/DebugSpace/index.ts +0 -7
- /package/dist/lib/browser/{react-context-TCD3MNIT.mjs.map → react-context-ZRLN5KUI.mjs.map} +0 -0
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { pipe } from 'effect';
|
|
5
6
|
import React, { useCallback } from 'react';
|
|
6
7
|
|
|
7
8
|
import {
|
|
8
9
|
Capabilities,
|
|
10
|
+
chain,
|
|
9
11
|
contributes,
|
|
10
12
|
createIntent,
|
|
11
13
|
createSurface,
|
|
@@ -32,17 +34,18 @@ import {
|
|
|
32
34
|
StoragePanel,
|
|
33
35
|
SwarmPanel,
|
|
34
36
|
TracingPanel,
|
|
35
|
-
DashboardPanel,
|
|
36
37
|
EdgeDashboardPanel,
|
|
37
|
-
SearchPanel,
|
|
38
38
|
AutomergePanel,
|
|
39
39
|
WorkflowPanel,
|
|
40
40
|
QueuesPanel,
|
|
41
41
|
InvocationTracePanel,
|
|
42
|
+
TestingPanel,
|
|
42
43
|
} from '@dxos/devtools';
|
|
43
44
|
import { SettingsStore } from '@dxos/local-storage';
|
|
45
|
+
import { log } from '@dxos/log';
|
|
44
46
|
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
45
47
|
import { Graph } from '@dxos/plugin-graph';
|
|
48
|
+
import { ScriptAction } from '@dxos/plugin-script/types';
|
|
46
49
|
import { SpaceAction, CollectionType } from '@dxos/plugin-space/types';
|
|
47
50
|
import {
|
|
48
51
|
SpaceState,
|
|
@@ -54,15 +57,7 @@ import {
|
|
|
54
57
|
parseId,
|
|
55
58
|
} from '@dxos/react-client/echo';
|
|
56
59
|
|
|
57
|
-
import {
|
|
58
|
-
DebugApp,
|
|
59
|
-
DebugObjectPanel,
|
|
60
|
-
DebugSettings,
|
|
61
|
-
DebugSpace,
|
|
62
|
-
DebugStatus,
|
|
63
|
-
SpaceGenerator,
|
|
64
|
-
Wireframe,
|
|
65
|
-
} from '../components';
|
|
60
|
+
import { DebugApp, DebugObjectPanel, DebugSettings, DebugStatus, SpaceGenerator, Wireframe } from '../components';
|
|
66
61
|
import { DEBUG_PLUGIN } from '../meta';
|
|
67
62
|
import { type DebugSettingsProps, Devtools } from '../types';
|
|
68
63
|
|
|
@@ -90,7 +85,7 @@ const useCurrentSpace = () => {
|
|
|
90
85
|
export default (context: PluginsContext) =>
|
|
91
86
|
contributes(Capabilities.ReactSurface, [
|
|
92
87
|
createSurface({
|
|
93
|
-
id: `${DEBUG_PLUGIN}/settings`,
|
|
88
|
+
id: `${DEBUG_PLUGIN}/plugin-settings`,
|
|
94
89
|
role: 'article',
|
|
95
90
|
filter: (data): data is { subject: SettingsStore<DebugSettingsProps> } =>
|
|
96
91
|
data.subject instanceof SettingsStore && data.subject.prefix === DEBUG_PLUGIN,
|
|
@@ -122,12 +117,7 @@ export default (context: PluginsContext) =>
|
|
|
122
117
|
[data.subject.space],
|
|
123
118
|
);
|
|
124
119
|
|
|
125
|
-
|
|
126
|
-
return deprecated ? (
|
|
127
|
-
<DebugSpace space={data.subject.space} onAddObjects={handleCreateObject} />
|
|
128
|
-
) : (
|
|
129
|
-
<SpaceGenerator space={data.subject.space} onCreateObjects={handleCreateObject} />
|
|
130
|
-
);
|
|
120
|
+
return <SpaceGenerator space={data.subject.space} onCreateObjects={handleCreateObject} />;
|
|
131
121
|
},
|
|
132
122
|
}),
|
|
133
123
|
createSurface({
|
|
@@ -151,10 +141,11 @@ export default (context: PluginsContext) =>
|
|
|
151
141
|
),
|
|
152
142
|
}),
|
|
153
143
|
createSurface({
|
|
154
|
-
id: `${DEBUG_PLUGIN}/
|
|
155
|
-
role: '
|
|
156
|
-
filter: (data): data is {
|
|
157
|
-
|
|
144
|
+
id: `${DEBUG_PLUGIN}/object-debug`,
|
|
145
|
+
role: 'article',
|
|
146
|
+
filter: (data): data is { companionTo: ReactiveEchoObject<any> } =>
|
|
147
|
+
data.subject === 'debug' && isEchoObject(data.companionTo),
|
|
148
|
+
component: ({ data }) => <DebugObjectPanel object={data.companionTo} />,
|
|
158
149
|
}),
|
|
159
150
|
createSurface({
|
|
160
151
|
id: `${DEBUG_PLUGIN}/status`,
|
|
@@ -170,7 +161,7 @@ export default (context: PluginsContext) =>
|
|
|
170
161
|
id: `${DEBUG_PLUGIN}/client/config`,
|
|
171
162
|
role: 'article',
|
|
172
163
|
filter: (data): data is any => data.subject === Devtools.Client.Config,
|
|
173
|
-
component: () => <ConfigPanel />,
|
|
164
|
+
component: () => <ConfigPanel vaultSelector={false} />,
|
|
174
165
|
}),
|
|
175
166
|
createSurface({
|
|
176
167
|
id: `${DEBUG_PLUGIN}/client/storage`,
|
|
@@ -218,7 +209,10 @@ export default (context: PluginsContext) =>
|
|
|
218
209
|
id: `${DEBUG_PLUGIN}/halo/credentials`,
|
|
219
210
|
role: 'article',
|
|
220
211
|
filter: (data): data is any => data.subject === Devtools.Halo.Credentials,
|
|
221
|
-
component: () =>
|
|
212
|
+
component: () => {
|
|
213
|
+
const space = useCurrentSpace();
|
|
214
|
+
return <CredentialsPanel space={space} />;
|
|
215
|
+
},
|
|
222
216
|
}),
|
|
223
217
|
createSurface({
|
|
224
218
|
id: `${DEBUG_PLUGIN}/echo/spaces`,
|
|
@@ -251,7 +245,10 @@ export default (context: PluginsContext) =>
|
|
|
251
245
|
id: `${DEBUG_PLUGIN}/echo/feeds`,
|
|
252
246
|
role: 'article',
|
|
253
247
|
filter: (data): data is any => data.subject === Devtools.Echo.Feeds,
|
|
254
|
-
component: () =>
|
|
248
|
+
component: () => {
|
|
249
|
+
const space = useCurrentSpace();
|
|
250
|
+
return <FeedsPanel space={space} />;
|
|
251
|
+
},
|
|
255
252
|
}),
|
|
256
253
|
createSurface({
|
|
257
254
|
id: `${DEBUG_PLUGIN}/echo/objects`,
|
|
@@ -266,7 +263,10 @@ export default (context: PluginsContext) =>
|
|
|
266
263
|
id: `${DEBUG_PLUGIN}/echo/automerge`,
|
|
267
264
|
role: 'article',
|
|
268
265
|
filter: (data): data is any => data.subject === Devtools.Echo.Automerge,
|
|
269
|
-
component: () =>
|
|
266
|
+
component: () => {
|
|
267
|
+
const space = useCurrentSpace();
|
|
268
|
+
return <AutomergePanel space={space} />;
|
|
269
|
+
},
|
|
270
270
|
}),
|
|
271
271
|
createSurface({
|
|
272
272
|
id: `${DEBUG_PLUGIN}/echo/queues`,
|
|
@@ -278,7 +278,10 @@ export default (context: PluginsContext) =>
|
|
|
278
278
|
id: `${DEBUG_PLUGIN}/echo/members`,
|
|
279
279
|
role: 'article',
|
|
280
280
|
filter: (data): data is any => data.subject === Devtools.Echo.Members,
|
|
281
|
-
component: () =>
|
|
281
|
+
component: () => {
|
|
282
|
+
const space = useCurrentSpace();
|
|
283
|
+
return <MembersPanel space={space} />;
|
|
284
|
+
},
|
|
282
285
|
}),
|
|
283
286
|
createSurface({
|
|
284
287
|
id: `${DEBUG_PLUGIN}/echo/metadata`,
|
|
@@ -302,20 +305,18 @@ export default (context: PluginsContext) =>
|
|
|
302
305
|
id: `${DEBUG_PLUGIN}/mesh/network`,
|
|
303
306
|
role: 'article',
|
|
304
307
|
filter: (data): data is any => data.subject === Devtools.Mesh.Network,
|
|
305
|
-
component: () =>
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
role: 'article',
|
|
310
|
-
filter: (data): data is any => data.subject === Devtools.Agent.Dashboard,
|
|
311
|
-
component: () => <DashboardPanel />,
|
|
312
|
-
}),
|
|
313
|
-
createSurface({
|
|
314
|
-
id: `${DEBUG_PLUGIN}/agent/search`,
|
|
315
|
-
role: 'article',
|
|
316
|
-
filter: (data): data is any => data.subject === Devtools.Agent.Search,
|
|
317
|
-
component: () => <SearchPanel />,
|
|
308
|
+
component: () => {
|
|
309
|
+
const space = useCurrentSpace();
|
|
310
|
+
return <NetworkPanel space={space} />;
|
|
311
|
+
},
|
|
318
312
|
}),
|
|
313
|
+
// TODO(wittjosiah): Remove?
|
|
314
|
+
// createSurface({
|
|
315
|
+
// id: `${DEBUG_PLUGIN}/agent/dashboard`,
|
|
316
|
+
// role: 'article',
|
|
317
|
+
// filter: (data): data is any => data.subject === Devtools.Agent.Dashboard,
|
|
318
|
+
// component: () => <DashboardPanel />,
|
|
319
|
+
// }),
|
|
319
320
|
createSurface({
|
|
320
321
|
id: `${DEBUG_PLUGIN}/edge/dashboard`,
|
|
321
322
|
role: 'article',
|
|
@@ -326,7 +327,10 @@ export default (context: PluginsContext) =>
|
|
|
326
327
|
id: `${DEBUG_PLUGIN}/edge/workflows`,
|
|
327
328
|
role: 'article',
|
|
328
329
|
filter: (data): data is any => data.subject === Devtools.Edge.Workflows,
|
|
329
|
-
component: () =>
|
|
330
|
+
component: () => {
|
|
331
|
+
const space = useCurrentSpace();
|
|
332
|
+
return <WorkflowPanel space={space} />;
|
|
333
|
+
},
|
|
330
334
|
}),
|
|
331
335
|
createSurface({
|
|
332
336
|
id: `${DEBUG_PLUGIN}/edge/traces`,
|
|
@@ -337,4 +341,34 @@ export default (context: PluginsContext) =>
|
|
|
337
341
|
return <InvocationTracePanel space={space} />;
|
|
338
342
|
},
|
|
339
343
|
}),
|
|
344
|
+
createSurface({
|
|
345
|
+
id: `${DEBUG_PLUGIN}/edge/testing`,
|
|
346
|
+
role: 'article',
|
|
347
|
+
filter: (data): data is any => data.subject === Devtools.Edge.Testing,
|
|
348
|
+
component: () => {
|
|
349
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
350
|
+
const onSpaceCreate = useCallback(
|
|
351
|
+
async (space: Space) => {
|
|
352
|
+
await space.waitUntilReady();
|
|
353
|
+
await dispatch(createIntent(SpaceAction.Migrate, { space }));
|
|
354
|
+
await space.db.flush();
|
|
355
|
+
},
|
|
356
|
+
[dispatch],
|
|
357
|
+
);
|
|
358
|
+
const onScriptPluginOpen = useCallback(
|
|
359
|
+
async (space: Space) => {
|
|
360
|
+
await space.waitUntilReady();
|
|
361
|
+
const result = await dispatch(
|
|
362
|
+
pipe(createIntent(ScriptAction.Create, { space }), chain(SpaceAction.AddObject, { target: space })),
|
|
363
|
+
);
|
|
364
|
+
log.info('script created', { result });
|
|
365
|
+
await dispatch(
|
|
366
|
+
createIntent(LayoutAction.Open, { part: 'main', subject: [`${space.id}:${result.data?.object.id}`] }),
|
|
367
|
+
);
|
|
368
|
+
},
|
|
369
|
+
[dispatch],
|
|
370
|
+
);
|
|
371
|
+
return <TestingPanel onSpaceCreate={onSpaceCreate} onScriptPluginOpen={onScriptPluginOpen} />;
|
|
372
|
+
},
|
|
373
|
+
}),
|
|
340
374
|
]);
|
|
@@ -9,9 +9,7 @@ import { DEBUG_PLUGIN } from '../meta';
|
|
|
9
9
|
import { type DebugSettingsProps, DebugSettingsSchema } from '../types';
|
|
10
10
|
|
|
11
11
|
export default () => {
|
|
12
|
-
const settings = create<DebugSettingsProps>({
|
|
13
|
-
debug: true,
|
|
14
|
-
});
|
|
12
|
+
const settings = create<DebugSettingsProps>({});
|
|
15
13
|
|
|
16
14
|
return contributes(Capabilities.Settings, { schema: DebugSettingsSchema, prefix: DEBUG_PLUGIN, value: settings });
|
|
17
15
|
};
|
|
@@ -78,9 +78,6 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
78
78
|
|
|
79
79
|
return (
|
|
80
80
|
<DeprecatedFormContainer>
|
|
81
|
-
<DeprecatedFormInput label={t('settings show debug panel')}>
|
|
82
|
-
<Input.Switch checked={settings.debug} onCheckedChange={(checked) => (settings.debug = !!checked)} />
|
|
83
|
-
</DeprecatedFormInput>
|
|
84
81
|
<DeprecatedFormInput label={t('settings wireframe')}>
|
|
85
82
|
<Input.Switch checked={settings.wireframe} onCheckedChange={(checked) => (settings.wireframe = !!checked)} />
|
|
86
83
|
</DeprecatedFormInput>
|
|
@@ -150,7 +150,7 @@ export const createGenerator = <T extends BaseObject>(type: TypedObject<T>): Obj
|
|
|
150
150
|
(await space.db.schemaRegistry.register([type]))[0];
|
|
151
151
|
|
|
152
152
|
// Create objects.
|
|
153
|
-
const generate = createAsyncGenerator(generator, schema.
|
|
153
|
+
const generate = createAsyncGenerator(generator, schema.snapshot, { db: space.db });
|
|
154
154
|
const objects = await generate.createObjects(n);
|
|
155
155
|
|
|
156
156
|
// Find or create table and view.
|
|
@@ -15,7 +15,7 @@ export type SchemaTableProps = {
|
|
|
15
15
|
|
|
16
16
|
export const SchemaTable = ({ types, objects = {}, label, onClick }: SchemaTableProps) => {
|
|
17
17
|
return (
|
|
18
|
-
<div className='grid grid-cols-[1fr_80px_40px] gap-1 overflow-
|
|
18
|
+
<div className='grid grid-cols-[1fr_80px_40px] gap-1 overflow-none'>
|
|
19
19
|
<div className='grid grid-cols-subgrid col-span-3'>
|
|
20
20
|
<div className='px-2 text-sm text-primary-500'>{label}</div>
|
|
21
21
|
<div className='px-2 text-xs text-subdued text-right'>count</div>
|
|
@@ -34,13 +34,7 @@ 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 = [
|
|
38
|
-
Testing.OrgType,
|
|
39
|
-
Testing.ProjectType,
|
|
40
|
-
Testing.ContactType,
|
|
41
|
-
Testing.EmailType,
|
|
42
|
-
Testing.MessageType,
|
|
43
|
-
];
|
|
37
|
+
const mutableTypes = [Testing.Org, Testing.Project, Testing.Contact, Testing.Message];
|
|
44
38
|
const [count, setCount] = useState(1);
|
|
45
39
|
const [info, setInfo] = useState<any>({});
|
|
46
40
|
|
|
@@ -118,7 +112,7 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
|
|
|
118
112
|
const parts = schema.typename.split('/');
|
|
119
113
|
const name = parts[parts.length - 1];
|
|
120
114
|
const table = create(TableType, { name, threads: [] });
|
|
121
|
-
await initializeTable({ space, table,
|
|
115
|
+
await initializeTable({ client, space, table, typename: schema.typename });
|
|
122
116
|
await dispatch(createIntent(SpaceAction.AddObject, { target: space, object: table }));
|
|
123
117
|
return table;
|
|
124
118
|
}),
|
|
@@ -145,7 +139,7 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
|
|
|
145
139
|
}, []);
|
|
146
140
|
|
|
147
141
|
return (
|
|
148
|
-
<div role='none' className='flex flex-col divide-y divide-separator'>
|
|
142
|
+
<div role='none' className='flex flex-col divide-y divide-separator overflow-y-auto'>
|
|
149
143
|
<Toolbar.Root classNames='p-1'>
|
|
150
144
|
<IconButton icon='ph--arrow-clockwise--regular' iconOnly label='Refresh' onClick={updateInfo} />
|
|
151
145
|
<IconButton
|
package/src/components/index.ts
CHANGED
|
@@ -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
|
-
}
|
|
18
|
+
};
|
package/src/translations.ts
CHANGED
|
@@ -51,16 +51,17 @@ export default [
|
|
|
51
51
|
'queues label': 'Queues',
|
|
52
52
|
'members label': 'Members',
|
|
53
53
|
'metadata label': 'Metadata',
|
|
54
|
-
'mesh label': '
|
|
54
|
+
'mesh label': 'MESH',
|
|
55
55
|
'signal label': 'Signal',
|
|
56
56
|
'swarm label': 'Swarm',
|
|
57
57
|
'network label': 'Network',
|
|
58
58
|
'agent label': 'Agent',
|
|
59
59
|
'dashboard label': 'Dashboard',
|
|
60
60
|
'search label': 'Search',
|
|
61
|
-
'edge label': '
|
|
61
|
+
'edge label': 'EDGE',
|
|
62
62
|
'workflows label': 'Workflows',
|
|
63
63
|
'traces label': 'Traces',
|
|
64
|
+
'testing label': 'Testing',
|
|
64
65
|
},
|
|
65
66
|
},
|
|
66
67
|
},
|
package/src/types.ts
CHANGED
|
@@ -21,7 +21,6 @@ export const DebugContext: Context<DebugContextType> = createContext<DebugContex
|
|
|
21
21
|
|
|
22
22
|
export const DebugSettingsSchema = S.mutable(
|
|
23
23
|
S.Struct({
|
|
24
|
-
debug: S.optional(S.Boolean),
|
|
25
24
|
wireframe: S.optional(S.Boolean),
|
|
26
25
|
}),
|
|
27
26
|
);
|
|
@@ -79,5 +78,6 @@ export namespace Devtools {
|
|
|
79
78
|
export const Dashboard = `${Devtools.Edge.id}.dashboard`;
|
|
80
79
|
export const Workflows = `${Devtools.Edge.id}.workflows`;
|
|
81
80
|
export const Traces = `${Devtools.Edge.id}.traces`;
|
|
81
|
+
export const Testing = `${Devtools.Edge.id}.testing`;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Container
|
|
3
|
-
} from "./chunk-GSJS3HEM.mjs";
|
|
4
|
-
import {
|
|
5
|
-
DebugContext
|
|
6
|
-
} from "./chunk-LHJC7LSH.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-5A2QOKAZ.mjs.map
|