@dxos/plugin-debug 0.9.0 → 0.9.1-staging.ee54ba693a
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/neutral/{DebugObjectPanel-OS65NC4M.mjs → DebugObjectPanel-QSGQJ3LM.mjs} +5 -3
- package/dist/lib/neutral/DebugObjectPanel-QSGQJ3LM.mjs.map +7 -0
- package/dist/lib/neutral/DebugPlugin.mjs +2 -2
- package/dist/lib/neutral/DebugPlugin.mjs.map +4 -4
- package/dist/lib/neutral/{DebugSettings-RKYNQIKH.mjs → DebugSettings-Q3WUL6YQ.mjs} +37 -31
- package/dist/lib/neutral/DebugSettings-Q3WUL6YQ.mjs.map +7 -0
- package/dist/lib/neutral/{DebugSpaceObjectsPanel-BHOCFWDJ.mjs → DebugSpaceObjectsPanel-AXFZWEIM.mjs} +5 -3
- package/dist/lib/neutral/DebugSpaceObjectsPanel-AXFZWEIM.mjs.map +7 -0
- package/dist/lib/neutral/{DevtoolsOverviewContainer-YX7Z3D2H.mjs → DevtoolsOverviewContainer-DWQHTK7D.mjs} +3 -2
- package/dist/lib/neutral/DevtoolsOverviewContainer-DWQHTK7D.mjs.map +7 -0
- package/dist/lib/neutral/{GithubPanel-QJKDJRVQ.mjs → GithubPanel-4CSJRVKE.mjs} +3 -3
- package/dist/lib/neutral/GithubPanel-4CSJRVKE.mjs.map +7 -0
- package/dist/lib/neutral/{app-graph-builder-4OJQQLSH.mjs → app-graph-builder-UKG4WVYK.mjs} +124 -131
- package/dist/lib/neutral/app-graph-builder-UKG4WVYK.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +4 -4
- package/dist/lib/neutral/chunk-72QXLYMI.mjs +118 -0
- package/dist/lib/neutral/chunk-72QXLYMI.mjs.map +7 -0
- package/dist/lib/neutral/chunk-R5C4CKOF.mjs +54 -0
- package/dist/lib/neutral/chunk-R5C4CKOF.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +13 -24
- package/dist/lib/neutral/components/index.mjs.map +4 -4
- package/dist/lib/neutral/containers/index.mjs +6 -4
- package/dist/lib/neutral/containers/index.mjs.map +3 -3
- package/dist/lib/neutral/index.mjs +6 -4
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/meta.mjs +1 -1
- package/dist/lib/neutral/plugin.mjs +1 -1
- package/dist/lib/neutral/{react-context-MUZ3KVLU.mjs → react-context-UJURDOO6.mjs} +2 -2
- package/dist/lib/neutral/{react-context-MUZ3KVLU.mjs.map → react-context-UJURDOO6.mjs.map} +3 -3
- package/dist/lib/neutral/{react-surface-YBC4HK7I.mjs → react-surface-URESE7J4.mjs} +89 -35
- package/dist/lib/neutral/react-surface-URESE7J4.mjs.map +7 -0
- package/dist/lib/neutral/{settings-MPM6YUP4.mjs → settings-5I2674B6.mjs} +3 -3
- package/dist/lib/neutral/{settings-MPM6YUP4.mjs.map → settings-5I2674B6.mjs.map} +3 -3
- package/dist/lib/neutral/translations.mjs +1 -2
- package/dist/lib/neutral/translations.mjs.map +3 -3
- package/dist/lib/neutral/types/index.mjs +5 -3
- package/dist/types/dx.config.d.ts +28 -0
- package/dist/types/dx.config.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- 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.d.ts +1 -6
- package/dist/types/src/capabilities/react-context.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/capabilities/settings.d.ts +1 -3
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts +6 -3
- package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/{components → containers}/DebugSettings/DebugSettings.d.ts +2 -2
- package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/DebugSettings/DebugSettings.stories.d.ts +0 -1
- package/dist/types/src/{components → containers}/DebugSettings/DebugSettings.stories.d.ts.map +1 -1
- package/dist/types/src/{components → containers}/DebugSettings/index.d.ts.map +1 -1
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +6 -2
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -1
- package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts.map +1 -1
- package/dist/types/src/containers/GithubPanel/GithubComponent.stories.d.ts +0 -1
- package/dist/types/src/containers/GithubPanel/GithubComponent.stories.d.ts.map +1 -1
- package/dist/types/src/containers/RegistryPanel/index.d.ts +1 -1
- package/dist/types/src/containers/RegistryPanel/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +1 -0
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +32 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +0 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Devtools.d.ts +57 -0
- package/dist/types/src/types/Devtools.d.ts.map +1 -0
- package/dist/types/src/types/debug.d.ts +20 -0
- package/dist/types/src/types/debug.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -69
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/surface.d.ts +4 -0
- package/dist/types/src/types/surface.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dx.config.ts +39 -0
- package/package.json +59 -58
- package/src/DebugPlugin.test.ts +1 -1
- package/src/DebugPlugin.tsx +1 -1
- package/src/capabilities/app-graph-builder.ts +123 -131
- package/src/capabilities/react-context.tsx +1 -1
- package/src/capabilities/react-surface.tsx +85 -33
- package/src/capabilities/settings.ts +2 -2
- package/src/components/SpaceGenerator/presets.ts +10 -13
- package/src/components/index.ts +0 -4
- package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +13 -4
- package/src/{components → containers}/DebugSettings/DebugSettings.stories.tsx +1 -1
- package/src/{components → containers}/DebugSettings/DebugSettings.tsx +100 -98
- package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +12 -4
- package/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx +3 -1
- package/src/containers/GithubPanel/GithubComponent.tsx +2 -2
- package/src/containers/RegistryPanel/index.ts +1 -1
- package/src/containers/index.ts +1 -0
- package/src/meta.ts +2 -31
- package/src/translations.ts +1 -2
- package/src/types/Devtools.ts +73 -0
- package/src/types/debug.ts +35 -0
- package/src/types/index.ts +3 -90
- package/src/types/surface.ts +10 -0
- package/dist/lib/neutral/DebugObjectPanel-OS65NC4M.mjs.map +0 -7
- package/dist/lib/neutral/DebugSettings-RKYNQIKH.mjs.map +0 -7
- package/dist/lib/neutral/DebugSpaceObjectsPanel-BHOCFWDJ.mjs.map +0 -7
- package/dist/lib/neutral/DevtoolsOverviewContainer-YX7Z3D2H.mjs.map +0 -7
- package/dist/lib/neutral/GithubPanel-QJKDJRVQ.mjs.map +0 -7
- package/dist/lib/neutral/app-graph-builder-4OJQQLSH.mjs.map +0 -7
- package/dist/lib/neutral/chunk-HOV6MV5B.mjs +0 -43
- package/dist/lib/neutral/chunk-HOV6MV5B.mjs.map +0 -7
- package/dist/lib/neutral/chunk-TAST3Y2C.mjs +0 -91
- package/dist/lib/neutral/chunk-TAST3Y2C.mjs.map +0 -7
- package/dist/lib/neutral/react-surface-YBC4HK7I.mjs.map +0 -7
- package/dist/types/src/components/DebugSettings/DebugSettings.d.ts.map +0 -1
- /package/dist/types/src/{components → containers}/DebugSettings/index.d.ts +0 -0
- /package/src/{components → containers}/DebugSettings/index.ts +0 -0
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { useAtomValue } from '@effect-atom/atom-react';
|
|
5
6
|
import * as Effect from 'effect/Effect';
|
|
6
7
|
import * as Option from 'effect/Option';
|
|
7
|
-
import React, { useCallback } from 'react';
|
|
8
|
+
import React, { useCallback, useMemo } from 'react';
|
|
8
9
|
|
|
9
10
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
10
|
-
import { Surface, useOperationInvoker, useSettingsState } from '@dxos/app-framework/ui';
|
|
11
|
-
import { AppCapabilities, LayoutOperation,
|
|
11
|
+
import { Surface, useAtomCapability, useOperationInvoker, useSettingsState } from '@dxos/app-framework/ui';
|
|
12
|
+
import { AppAnnotation, AppCapabilities, LayoutOperation, Paths } from '@dxos/app-toolkit';
|
|
12
13
|
import { AppSurface, useActiveSpace } from '@dxos/app-toolkit/ui';
|
|
14
|
+
import { EDGE_SERVICE_DEFAULTS, EdgeServiceName } from '@dxos/config';
|
|
13
15
|
import {
|
|
14
16
|
AutomergePanel,
|
|
15
17
|
ConfigPanel,
|
|
@@ -37,19 +39,22 @@ import {
|
|
|
37
39
|
TestingPanel,
|
|
38
40
|
WorkflowPanel,
|
|
39
41
|
} from '@dxos/devtools';
|
|
40
|
-
import { Annotation, Collection, Feed, Obj } from '@dxos/echo';
|
|
42
|
+
import { Annotation, Collection, Entity, Feed, Filter, Obj, Type } from '@dxos/echo';
|
|
43
|
+
import { HiddenAnnotation } from '@dxos/echo/Annotation';
|
|
41
44
|
import { log } from '@dxos/log';
|
|
42
45
|
import { type IdbLogStore } from '@dxos/log-store-idb';
|
|
43
46
|
import { type Graph } from '@dxos/plugin-graph';
|
|
44
47
|
import { ScriptOperation } from '@dxos/plugin-script';
|
|
45
|
-
import { SpaceOperation } from '@dxos/plugin-space';
|
|
48
|
+
import { SpaceCapabilities, SpaceOperation } from '@dxos/plugin-space';
|
|
49
|
+
import { useClient } from '@dxos/react-client';
|
|
46
50
|
import { type Space, SpaceState, isSpace } from '@dxos/react-client/echo';
|
|
47
51
|
import { ToolsExplorer } from '@dxos/react-ui-introspect';
|
|
52
|
+
import { Position } from '@dxos/util';
|
|
48
53
|
|
|
49
|
-
import { DebugSettings } from '#components';
|
|
50
54
|
import {
|
|
51
55
|
DebugGraph,
|
|
52
56
|
DebugObjectPanel,
|
|
57
|
+
DebugSettings,
|
|
53
58
|
DebugSpaceObjectsPanel,
|
|
54
59
|
DebugStatus,
|
|
55
60
|
DevtoolsOverviewContainer,
|
|
@@ -58,10 +63,9 @@ import {
|
|
|
58
63
|
Wireframe,
|
|
59
64
|
} from '#containers';
|
|
60
65
|
import { meta } from '#meta';
|
|
61
|
-
import { DebugCapabilities, type Settings
|
|
66
|
+
import { DebugCapabilities, Devtools, type Settings } from '#types';
|
|
62
67
|
|
|
63
|
-
|
|
64
|
-
const MCP_SERVER_URL = 'https://introspect-service-labs.dxos.workers.dev/mcp';
|
|
68
|
+
const MCP_SERVER_URL = EDGE_SERVICE_DEFAULTS[EdgeServiceName.Introspect];
|
|
65
69
|
|
|
66
70
|
type SpaceDebug = {
|
|
67
71
|
type: string;
|
|
@@ -73,7 +77,8 @@ type GraphDebug = {
|
|
|
73
77
|
root: string;
|
|
74
78
|
};
|
|
75
79
|
|
|
76
|
-
const isSpaceDebug = (data: any): data is SpaceDebug =>
|
|
80
|
+
const isSpaceDebug = (data: any): data is SpaceDebug =>
|
|
81
|
+
data?.type === `${meta.profile.key}.space` && isSpace(data.space);
|
|
77
82
|
const isGraphDebug = (data: any): data is GraphDebug => {
|
|
78
83
|
const graph = data?.graph;
|
|
79
84
|
return (
|
|
@@ -81,6 +86,46 @@ const isGraphDebug = (data: any): data is GraphDebug => {
|
|
|
81
86
|
);
|
|
82
87
|
};
|
|
83
88
|
|
|
89
|
+
/** Returns `onOpen` and `canOpen` for the ObjectsTree "Open" action. */
|
|
90
|
+
const useObjectOpenAction = (invokePromise: ReturnType<typeof useOperationInvoker>['invokePromise']) => {
|
|
91
|
+
const client = useClient();
|
|
92
|
+
const spaceSettings = useAtomCapability(SpaceCapabilities.Settings);
|
|
93
|
+
const showHidden = spaceSettings?.showHidden ?? false;
|
|
94
|
+
|
|
95
|
+
const allTypes = useAtomValue(useMemo(() => client.graph.registry.query(Filter.type(Type.Type)).atom, [client]));
|
|
96
|
+
|
|
97
|
+
const hiddenTypenames = useMemo(() => {
|
|
98
|
+
const result = new Set<string>();
|
|
99
|
+
for (const typeEntity of allTypes) {
|
|
100
|
+
const schema = Type.getSchema(typeEntity);
|
|
101
|
+
if (HiddenAnnotation.get(schema).pipe(Option.getOrElse(() => false))) {
|
|
102
|
+
result.add(Type.getTypename(typeEntity));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return result;
|
|
106
|
+
}, [allTypes]);
|
|
107
|
+
|
|
108
|
+
const onOpen = useCallback(
|
|
109
|
+
(object: Obj.Unknown) => {
|
|
110
|
+
void invokePromise(LayoutOperation.Open, { subject: [Paths.getObjectPathFromObject(object)] });
|
|
111
|
+
},
|
|
112
|
+
[invokePromise],
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
const canOpen = useCallback(
|
|
116
|
+
(entity: Entity.Snapshot) => {
|
|
117
|
+
if (showHidden) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
const typename = Entity.getTypename(entity);
|
|
121
|
+
return !hiddenTypenames.has(typename ?? '');
|
|
122
|
+
},
|
|
123
|
+
[showHidden, hiddenTypenames],
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
return { onOpen, canOpen };
|
|
127
|
+
};
|
|
128
|
+
|
|
84
129
|
type ReactSurfaceOptions = {
|
|
85
130
|
logStore?: IdbLogStore;
|
|
86
131
|
};
|
|
@@ -95,7 +140,7 @@ export default Capability.makeModule(
|
|
|
95
140
|
return Capability.contributes(Capabilities.ReactSurface, [
|
|
96
141
|
Surface.create({
|
|
97
142
|
id: 'pluginSettings',
|
|
98
|
-
filter: AppSurface.settings(AppSurface.Article, meta.
|
|
143
|
+
filter: AppSurface.settings(AppSurface.Article, meta.profile.key),
|
|
99
144
|
component: ({ data: { subject } }) => {
|
|
100
145
|
const { settings, updateSettings } = useSettingsState<Settings.Settings>(subject.atom);
|
|
101
146
|
return (
|
|
@@ -110,8 +155,7 @@ export default Capability.makeModule(
|
|
|
110
155
|
}),
|
|
111
156
|
Surface.create({
|
|
112
157
|
id: 'space',
|
|
113
|
-
|
|
114
|
-
filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),
|
|
158
|
+
filter: AppSurface.subject(AppSurface.Article, isSpaceDebug),
|
|
115
159
|
component: ({ role, data }) => {
|
|
116
160
|
const { invokePromise } = useOperationInvoker();
|
|
117
161
|
|
|
@@ -123,8 +167,9 @@ export default Capability.makeModule(
|
|
|
123
167
|
|
|
124
168
|
const collection =
|
|
125
169
|
data.subject.space.state.get() === SpaceState.SPACE_READY &&
|
|
126
|
-
Annotation.get(data.subject.space.properties, RootCollectionAnnotation).pipe(
|
|
127
|
-
|
|
170
|
+
Annotation.get(data.subject.space.properties, AppAnnotation.RootCollectionAnnotation).pipe(
|
|
171
|
+
Option.getOrUndefined,
|
|
172
|
+
)?.target;
|
|
128
173
|
if (!Obj.instanceOf(Collection.Collection, collection)) {
|
|
129
174
|
return;
|
|
130
175
|
}
|
|
@@ -144,8 +189,7 @@ export default Capability.makeModule(
|
|
|
144
189
|
}),
|
|
145
190
|
Surface.create({
|
|
146
191
|
id: 'appGraph',
|
|
147
|
-
|
|
148
|
-
filter: (data): data is { subject: GraphDebug } => isGraphDebug(data.subject),
|
|
192
|
+
filter: AppSurface.subject(AppSurface.Article, isGraphDebug),
|
|
149
193
|
component: ({ data }) => <DebugGraph graph={data.subject.graph} root={data.subject.root} />,
|
|
150
194
|
}),
|
|
151
195
|
Surface.create({
|
|
@@ -161,12 +205,17 @@ export default Capability.makeModule(
|
|
|
161
205
|
Surface.create({
|
|
162
206
|
id: 'wireframe',
|
|
163
207
|
// TODO(wittjosiah): Split into multiple surfaces if this filter proves too strict for non-article roles.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
208
|
+
filter: AppSurface.oneOf(
|
|
209
|
+
AppSurface.subject(AppSurface.Article, (value): value is Obj.Unknown => {
|
|
210
|
+
const settings = registry.get(settingsAtom);
|
|
211
|
+
return Obj.isObject(value) && !!settings.wireframe;
|
|
212
|
+
}),
|
|
213
|
+
AppSurface.subject(AppSurface.Section, (value): value is Obj.Unknown => {
|
|
214
|
+
const settings = registry.get(settingsAtom);
|
|
215
|
+
return Obj.isObject(value) && !!settings.wireframe;
|
|
216
|
+
}),
|
|
217
|
+
),
|
|
218
|
+
position: Position.first,
|
|
170
219
|
component: ({ data, role, name }) => (
|
|
171
220
|
<Wireframe label={`${role}:${name}`} object={data.subject} classNames='row-span-2 overflow-hidden' />
|
|
172
221
|
),
|
|
@@ -177,33 +226,36 @@ export default Capability.makeModule(
|
|
|
177
226
|
AppSurface.literal(AppSurface.Article, 'debug'),
|
|
178
227
|
AppSurface.companion(AppSurface.Article),
|
|
179
228
|
),
|
|
180
|
-
component: ({ role, data }) =>
|
|
229
|
+
component: ({ role, data }) => {
|
|
230
|
+
const { invokePromise } = useOperationInvoker();
|
|
231
|
+
const { onOpen, canOpen } = useObjectOpenAction(invokePromise);
|
|
232
|
+
return <DebugObjectPanel role={role} companionTo={data.companionTo} onOpen={onOpen} canOpen={canOpen} />;
|
|
233
|
+
},
|
|
181
234
|
}),
|
|
182
235
|
Surface.create({
|
|
183
236
|
id: 'devtoolsOverview',
|
|
184
|
-
filter:
|
|
237
|
+
filter: Surface.makeFilter(AppSurface.deckCompanion('devtools')),
|
|
185
238
|
component: () => <DevtoolsOverviewContainer />,
|
|
186
239
|
}),
|
|
187
240
|
Surface.create({
|
|
188
241
|
id: 'spaceObjects',
|
|
189
|
-
filter: AppSurface.
|
|
190
|
-
Surface.makeType<{ subject: string }>('deck-companion--space-objects'),
|
|
191
|
-
'space-objects',
|
|
192
|
-
),
|
|
242
|
+
filter: Surface.makeFilter(AppSurface.deckCompanion('spaceObjects')),
|
|
193
243
|
component: () => {
|
|
194
244
|
const space = useActiveSpace();
|
|
245
|
+
const { invokePromise } = useOperationInvoker();
|
|
246
|
+
const { onOpen, canOpen } = useObjectOpenAction(invokePromise);
|
|
195
247
|
if (!space) {
|
|
196
248
|
return null;
|
|
197
249
|
}
|
|
198
250
|
|
|
199
|
-
return <DebugSpaceObjectsPanel space={space} />;
|
|
251
|
+
return <DebugSpaceObjectsPanel space={space} onOpen={onOpen} canOpen={canOpen} />;
|
|
200
252
|
},
|
|
201
253
|
}),
|
|
202
254
|
|
|
203
255
|
Surface.create({
|
|
204
256
|
id: 'debugStatus',
|
|
205
|
-
|
|
206
|
-
position:
|
|
257
|
+
filter: Surface.makeFilter(AppSurface.StatusIndicator),
|
|
258
|
+
position: Position.first,
|
|
207
259
|
component: () => <DebugStatus />,
|
|
208
260
|
}),
|
|
209
261
|
|
|
@@ -438,7 +490,7 @@ export default Capability.makeModule(
|
|
|
438
490
|
log.info('script created', { result: createResult });
|
|
439
491
|
if (createResult.data?.object) {
|
|
440
492
|
await invokePromise(LayoutOperation.Open, {
|
|
441
|
-
subject: [getObjectPathFromObject(createResult.data.object)],
|
|
493
|
+
subject: [Paths.getObjectPathFromObject(createResult.data.object)],
|
|
442
494
|
});
|
|
443
495
|
}
|
|
444
496
|
},
|
|
@@ -14,7 +14,7 @@ import { DebugCapabilities, Settings } from '#types';
|
|
|
14
14
|
export default Capability.makeModule(() =>
|
|
15
15
|
Effect.sync(() => {
|
|
16
16
|
const settingsAtom = createKvsStore({
|
|
17
|
-
key: meta.
|
|
17
|
+
key: meta.profile.key,
|
|
18
18
|
schema: Settings.Settings,
|
|
19
19
|
defaultValue: () => ({}),
|
|
20
20
|
});
|
|
@@ -22,7 +22,7 @@ export default Capability.makeModule(() =>
|
|
|
22
22
|
return [
|
|
23
23
|
Capability.contributes(DebugCapabilities.Settings, settingsAtom),
|
|
24
24
|
Capability.contributes(AppCapabilities.Settings, {
|
|
25
|
-
prefix: meta.
|
|
25
|
+
prefix: meta.profile.key,
|
|
26
26
|
schema: Settings.Settings,
|
|
27
27
|
atom: settingsAtom,
|
|
28
28
|
}),
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { RunInstructions, WebSearchSkill } from '@dxos/assistant-toolkit';
|
|
8
|
+
import { Instructions, Operation, Trigger } from '@dxos/compute';
|
|
9
9
|
import { type ComputeGraphModel, NODE_INPUT } from '@dxos/conductor';
|
|
10
10
|
import { Feed, Filter, JsonSchema, Key, Obj, Query, type QueryAST, Ref, Scope, Tag } from '@dxos/echo';
|
|
11
11
|
import { invariant } from '@dxos/invariant';
|
|
@@ -135,7 +135,7 @@ export const generator = () => ({
|
|
|
135
135
|
Trigger.make({
|
|
136
136
|
enabled: true,
|
|
137
137
|
spec: Trigger.specTimer('* * * * *'), // Every minute.
|
|
138
|
-
|
|
138
|
+
runnable: Ref.make(Operation.serialize(InboxOperation.GoogleMailSync)),
|
|
139
139
|
input: {
|
|
140
140
|
mailbox: Ref.make(mailbox),
|
|
141
141
|
},
|
|
@@ -143,22 +143,18 @@ export const generator = () => ({
|
|
|
143
143
|
);
|
|
144
144
|
|
|
145
145
|
const researchPrompt = space.db.add(
|
|
146
|
-
|
|
146
|
+
Instructions.make({
|
|
147
147
|
name: 'Research',
|
|
148
148
|
description: 'Research organization',
|
|
149
|
-
input: Schema.Struct({
|
|
150
|
-
org: Schema.Any,
|
|
151
|
-
}),
|
|
152
|
-
output: Schema.Any,
|
|
153
149
|
|
|
154
150
|
// TODO(dmaretskyi): This mocks research (returns pre-baked result), the actual research might take compute minutes.
|
|
155
151
|
// Remove the mock prompt to do the actual research.
|
|
156
|
-
|
|
152
|
+
text: trim`
|
|
157
153
|
Research the organization provided as input.
|
|
158
154
|
Create a research note for it at the end.
|
|
159
155
|
NOTE: Do mocked reseach (set mockSearch to true).
|
|
160
156
|
`,
|
|
161
|
-
|
|
157
|
+
skills: [Ref.make(WebSearchSkill.make())],
|
|
162
158
|
}),
|
|
163
159
|
);
|
|
164
160
|
|
|
@@ -166,9 +162,9 @@ export const generator = () => ({
|
|
|
166
162
|
Trigger.make({
|
|
167
163
|
enabled: true,
|
|
168
164
|
spec: Trigger.specSubscription(organizationsQuery),
|
|
169
|
-
|
|
165
|
+
runnable: Ref.make(Operation.serialize(RunInstructions)),
|
|
170
166
|
input: {
|
|
171
|
-
|
|
167
|
+
instructions: Ref.make(researchPrompt),
|
|
172
168
|
input: '{{event.subject}}',
|
|
173
169
|
},
|
|
174
170
|
}),
|
|
@@ -790,7 +786,8 @@ const attachTrigger = (functionTrigger: Trigger.Trigger | undefined, computeMode
|
|
|
790
786
|
invariant(functionTrigger);
|
|
791
787
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
|
|
792
788
|
Obj.update(functionTrigger, (functionTrigger) => {
|
|
793
|
-
|
|
789
|
+
// TODO(wittjosiah): Widen Runnable union to include ComputeGraph and remove cast.
|
|
790
|
+
functionTrigger.runnable = Ref.make(computeModel.root) as any;
|
|
794
791
|
functionTrigger.inputNodeId = inputNode.id;
|
|
795
792
|
});
|
|
796
793
|
};
|
package/src/components/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ import React, { useMemo, useState } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
8
|
import { ObjectsTree } from '@dxos/devtools';
|
|
9
|
-
import { Filter, Json, Obj, Query } from '@dxos/echo';
|
|
9
|
+
import { type Entity, Filter, Json, Obj, Query } from '@dxos/echo';
|
|
10
10
|
import type { EntityId } from '@dxos/keys';
|
|
11
11
|
import { useQuery } from '@dxos/react-client/echo';
|
|
12
12
|
import { Clipboard, Input, Panel, ScrollArea, Toolbar } from '@dxos/react-ui';
|
|
@@ -16,9 +16,12 @@ import { mx } from '@dxos/ui-theme';
|
|
|
16
16
|
export type DebugObjectPanelProps = Pick<
|
|
17
17
|
AppSurface.ObjectArticleProps<Obj.Unknown, {}, Obj.Unknown>,
|
|
18
18
|
'role' | 'companionTo'
|
|
19
|
-
|
|
19
|
+
> & {
|
|
20
|
+
onOpen?: (object: Obj.Unknown) => void;
|
|
21
|
+
canOpen?: (entity: Entity.Snapshot) => boolean;
|
|
22
|
+
};
|
|
20
23
|
|
|
21
|
-
export const DebugObjectPanel = ({ role, companionTo }: DebugObjectPanelProps) => {
|
|
24
|
+
export const DebugObjectPanel = ({ role, companionTo, onOpen, canOpen }: DebugObjectPanelProps) => {
|
|
22
25
|
const db = Obj.getDatabase(companionTo);
|
|
23
26
|
const [selectedId, setSelectedId] = useState<EntityId | null>(null);
|
|
24
27
|
const [depth, setDepth] = useState(0);
|
|
@@ -39,7 +42,13 @@ export const DebugObjectPanel = ({ role, companionTo }: DebugObjectPanelProps) =
|
|
|
39
42
|
{db && (
|
|
40
43
|
<ScrollArea.Root>
|
|
41
44
|
<ScrollArea.Viewport>
|
|
42
|
-
<ObjectsTree
|
|
45
|
+
<ObjectsTree
|
|
46
|
+
db={db}
|
|
47
|
+
root={companionTo}
|
|
48
|
+
onSelect={(entity) => setSelectedId(entity.id)}
|
|
49
|
+
onOpen={onOpen}
|
|
50
|
+
canOpen={canOpen}
|
|
51
|
+
/>
|
|
43
52
|
</ScrollArea.Viewport>
|
|
44
53
|
</ScrollArea.Root>
|
|
45
54
|
)}
|
|
@@ -12,7 +12,7 @@ import { translations } from '#translations';
|
|
|
12
12
|
import { DebugSettings } from './DebugSettings';
|
|
13
13
|
|
|
14
14
|
const meta = {
|
|
15
|
-
title: 'plugins/plugin-debug/
|
|
15
|
+
title: 'plugins/plugin-debug/containers/DebugSettings',
|
|
16
16
|
component: DebugSettings,
|
|
17
17
|
decorators: [withTheme(), withLayout({ layout: 'fullscreen' }), withClientProvider({ createIdentity: true })],
|
|
18
18
|
tags: ['settings'],
|
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { AppCapabilities,
|
|
7
|
+
import { AppCapabilities, AppSpace } from '@dxos/app-toolkit';
|
|
8
8
|
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
9
9
|
import { type ConfigProto, SaveConfig, Storage, defs } from '@dxos/config';
|
|
10
10
|
import { log } from '@dxos/log';
|
|
11
11
|
import { type IdbLogStore } from '@dxos/log-store-idb';
|
|
12
12
|
import { useClient } from '@dxos/react-client';
|
|
13
13
|
import { IconButton, Input, Select, Toast, useFileDownload, useTranslation } from '@dxos/react-ui';
|
|
14
|
-
import {
|
|
14
|
+
import { Form } from '@dxos/react-ui-form';
|
|
15
15
|
import { TRACE_ALL_KEY } from '@dxos/tracing';
|
|
16
16
|
import { setDeep } from '@dxos/util';
|
|
17
17
|
|
|
18
18
|
import { meta } from '#meta';
|
|
19
|
-
import {
|
|
19
|
+
import { Settings } from '#types';
|
|
20
20
|
|
|
21
21
|
type Toast = {
|
|
22
22
|
title: string;
|
|
@@ -28,7 +28,7 @@ const StorageAdapters = {
|
|
|
28
28
|
idb: defs.Runtime.Client.Storage.StorageDriver.IDB,
|
|
29
29
|
} as const;
|
|
30
30
|
|
|
31
|
-
export type DebugSettingsProps = AppSurface.
|
|
31
|
+
export type DebugSettingsProps = AppSurface.SettingsProps<
|
|
32
32
|
Settings.Settings,
|
|
33
33
|
{
|
|
34
34
|
logStore: IdbLogStore;
|
|
@@ -37,7 +37,7 @@ export type DebugSettingsProps = AppSurface.SettingsArticleProps<
|
|
|
37
37
|
>;
|
|
38
38
|
|
|
39
39
|
export const DebugSettings = ({ settings, onSettingsChange, logStore, onUpload }: DebugSettingsProps) => {
|
|
40
|
-
const { t } = useTranslation(meta.
|
|
40
|
+
const { t } = useTranslation(meta.profile.key);
|
|
41
41
|
const [toast, setToast] = useState<Toast>();
|
|
42
42
|
const download = useFileDownload();
|
|
43
43
|
const [storageConfig, setStorageConfig] = useState<ConfigProto>({});
|
|
@@ -65,7 +65,7 @@ export const DebugSettings = ({ settings, onSettingsChange, logStore, onUpload }
|
|
|
65
65
|
download(file, fileName);
|
|
66
66
|
|
|
67
67
|
if (onUpload) {
|
|
68
|
-
const personalSpace = getPersonalSpace(client);
|
|
68
|
+
const personalSpace = AppSpace.getPersonalSpace(client);
|
|
69
69
|
if (!personalSpace) {
|
|
70
70
|
log.error('no personal space available for upload');
|
|
71
71
|
return;
|
|
@@ -152,100 +152,102 @@ export const DebugSettings = ({ settings, onSettingsChange, logStore, onUpload }
|
|
|
152
152
|
);
|
|
153
153
|
|
|
154
154
|
return (
|
|
155
|
-
<
|
|
156
|
-
<
|
|
157
|
-
<
|
|
158
|
-
<
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
155
|
+
<Form.Root schema={Settings.Settings} values={settings} variant='settings' readonly={!onSettingsChange}>
|
|
156
|
+
<Form.Viewport scroll>
|
|
157
|
+
<Form.Content>
|
|
158
|
+
<Form.Section title={meta.profile.name ?? meta.profile.key}>
|
|
159
|
+
<Form.Row label={t('settings.wireframe.label')} description={t('settings.wireframe.description')}>
|
|
160
|
+
<Input.Root>
|
|
161
|
+
<Input.Switch
|
|
162
|
+
disabled={!onSettingsChange}
|
|
163
|
+
checked={settings.wireframe}
|
|
164
|
+
onCheckedChange={handleWireframeChange}
|
|
165
|
+
/>
|
|
166
|
+
</Input.Root>
|
|
167
|
+
</Form.Row>
|
|
168
|
+
<Form.Row label={t('settings.trace-all.label')} description={t('settings.trace-all.description')}>
|
|
169
|
+
<Input.Root>
|
|
170
|
+
<Input.Switch disabled={!onSettingsChange} checked={traceAll} onCheckedChange={handleTraceAllChange} />
|
|
171
|
+
</Input.Root>
|
|
172
|
+
</Form.Row>
|
|
173
|
+
<Form.Row label={t('settings.tracing-panel.label')} description={t('settings.tracing-panel.description')}>
|
|
174
|
+
<IconButton
|
|
175
|
+
icon='ph--arrow-square-out--regular'
|
|
176
|
+
iconOnly
|
|
177
|
+
label={t('settings.tracing-panel.label')}
|
|
178
|
+
onClick={handleOpenTracingPanel}
|
|
179
|
+
/>
|
|
180
|
+
</Form.Row>
|
|
181
|
+
<Form.Row
|
|
182
|
+
label={t('settings.download-diagnostics.label')}
|
|
183
|
+
description={t('settings.download-diagnostics.description')}
|
|
184
|
+
>
|
|
185
|
+
<IconButton
|
|
186
|
+
icon='ph--download-simple--regular'
|
|
187
|
+
iconOnly
|
|
188
|
+
label={t('settings.download-diagnostics.label')}
|
|
189
|
+
onClick={handleDownload}
|
|
190
|
+
/>
|
|
191
|
+
</Form.Row>
|
|
192
|
+
<Form.Row label={t('settings.download-logs.label')} description={t('settings.download-logs.description')}>
|
|
193
|
+
<IconButton
|
|
194
|
+
icon='ph--download-simple--regular'
|
|
195
|
+
iconOnly
|
|
196
|
+
label={t('settings.download-logs.label')}
|
|
197
|
+
onClick={handleDownloadLogs}
|
|
198
|
+
/>
|
|
199
|
+
</Form.Row>
|
|
200
|
+
<Form.Row label={t('settings.repair.label')} description={t('settings.repair.description')}>
|
|
201
|
+
<IconButton
|
|
202
|
+
icon='ph--first-aid-kit--regular'
|
|
203
|
+
iconOnly
|
|
204
|
+
label={t('settings.repair.label')}
|
|
205
|
+
onClick={handleRepair}
|
|
206
|
+
/>
|
|
207
|
+
</Form.Row>
|
|
208
208
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
209
|
+
{/* TODO(burdon): Move to layout? */}
|
|
210
|
+
{toast && (
|
|
211
|
+
<Toast.Root>
|
|
212
|
+
<Toast.Title icon='ph--gift--duotone'>
|
|
213
|
+
<span>{toast.title}</span>
|
|
214
|
+
</Toast.Title>
|
|
215
|
+
{toast.description && <Toast.Description>{toast.description}</Toast.Description>}
|
|
216
|
+
</Toast.Root>
|
|
217
|
+
)}
|
|
218
218
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
219
|
+
<Form.Row
|
|
220
|
+
label={t('settings.choose-storage-adaptor.label')}
|
|
221
|
+
description={t('settings.choose-storage-adaptor.description')}
|
|
222
|
+
>
|
|
223
|
+
<Select.Root
|
|
224
|
+
disabled={!onSettingsChange}
|
|
225
|
+
value={
|
|
226
|
+
Object.entries(StorageAdapters).find(
|
|
227
|
+
([_name, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore,
|
|
228
|
+
)?.[0]
|
|
229
|
+
}
|
|
230
|
+
onValueChange={handleStorageAdapterChange}
|
|
231
|
+
>
|
|
232
|
+
<Select.TriggerButton disabled={!onSettingsChange} placeholder={t('settings.data-store.label')} />
|
|
233
|
+
<Select.Portal>
|
|
234
|
+
<Select.Content>
|
|
235
|
+
<Select.Viewport>
|
|
236
|
+
{Object.keys(StorageAdapters).map((key) => (
|
|
237
|
+
<Select.Option key={key} value={key}>
|
|
238
|
+
{t(`settings.storage-adaptor.${key}.label`)}
|
|
239
|
+
</Select.Option>
|
|
240
|
+
))}
|
|
241
|
+
</Select.Viewport>
|
|
242
|
+
<Select.Arrow />
|
|
243
|
+
</Select.Content>
|
|
244
|
+
</Select.Portal>
|
|
245
|
+
</Select.Root>
|
|
246
|
+
</Form.Row>
|
|
247
|
+
</Form.Section>
|
|
248
|
+
</Form.Content>
|
|
249
|
+
</Form.Viewport>
|
|
250
|
+
</Form.Root>
|
|
249
251
|
);
|
|
250
252
|
};
|
|
251
253
|
|