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