@dxos/plugin-debug 0.8.4-main.72ec0f3 → 0.8.4-main.937b3ca
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-6VMEOKEV.mjs +15 -0
- package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs.map +7 -0
- package/dist/lib/browser/DevtoolsOverviewContainer-77PKFLYV.mjs +19 -0
- package/dist/lib/browser/{DevtoolsOverviewContainer-JXVZVPHN.mjs.map → DevtoolsOverviewContainer-77PKFLYV.mjs.map} +1 -1
- package/dist/lib/browser/{SpaceGenerator-46TAISVE.mjs → SpaceGenerator-ZHVZWGM7.mjs} +192 -195
- package/dist/lib/browser/SpaceGenerator-ZHVZWGM7.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-FBDRMMYF.mjs +597 -0
- package/dist/lib/browser/app-graph-builder-FBDRMMYF.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-WZFZ4ESO.mjs → chunk-A5H5GRV6.mjs} +1 -1
- package/dist/lib/browser/chunk-A5H5GRV6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +33 -38
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-FSWBT3MH.mjs +17 -0
- package/dist/lib/browser/react-context-FSWBT3MH.mjs.map +7 -0
- package/dist/lib/browser/react-surface-W62RJ32U.mjs +757 -0
- package/dist/lib/browser/react-surface-W62RJ32U.mjs.map +7 -0
- package/dist/lib/browser/settings-KA4GN73K.mjs +31 -0
- package/dist/lib/browser/settings-KA4GN73K.mjs.map +7 -0
- package/dist/types/src/DebugPlugin.d.ts +2 -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 +3 -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 +5 -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 +5 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/components/DebugGraph.d.ts +5 -4
- package/dist/types/src/components/DebugGraph.d.ts.map +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts +4 -2
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- 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/SpaceGenerator.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +1 -4
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts +1 -1
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.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 +76 -71
- package/src/DebugPlugin.tsx +16 -31
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +419 -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 +409 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +30 -0
- package/src/components/DebugGraph.tsx +4 -3
- package/src/components/DebugObjectPanel.tsx +4 -4
- package/src/components/DebugSettings.tsx +10 -5
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +15 -16
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +7 -5
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +17 -12
- package/src/components/SpaceGenerator/presets.ts +151 -37
- package/src/components/Wireframe.tsx +2 -2
- package/src/components/index.ts +4 -1
- package/src/meta.ts +2 -2
- 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-JXVZVPHN.mjs +0 -25
- package/dist/lib/browser/SpaceGenerator-46TAISVE.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs +0 -588
- package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs.map +0 -7
- package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +0 -7
- package/dist/lib/browser/react-context-P2YDWEWI.mjs +0 -16
- package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +0 -7
- package/dist/lib/browser/react-surface-2SNVZDEA.mjs +0 -774
- package/dist/lib/browser/react-surface-2SNVZDEA.mjs.map +0 -7
- package/dist/lib/browser/settings-SQXR3OAH.mjs +0 -22
- package/dist/lib/browser/settings-SQXR3OAH.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/src/capabilities/app-graph-builder.ts +0 -431
- package/src/capabilities/react-context.tsx +0 -16
- package/src/capabilities/react-surface.tsx +0 -418
- package/src/capabilities/settings.ts +0 -19
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
6
7
|
import React from 'react';
|
|
7
8
|
|
|
8
|
-
import {
|
|
9
|
+
import { OperationPlugin } from '@dxos/app-framework';
|
|
9
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
11
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
11
12
|
import { useSpaces } from '@dxos/react-client/echo';
|
|
@@ -32,11 +33,12 @@ const meta = {
|
|
|
32
33
|
withPluginManager({
|
|
33
34
|
plugins: [
|
|
34
35
|
ClientPlugin({
|
|
35
|
-
onClientInitialized:
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
onClientInitialized: ({ client }) =>
|
|
37
|
+
Effect.gen(function* () {
|
|
38
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
39
|
+
}),
|
|
38
40
|
}),
|
|
39
|
-
|
|
41
|
+
OperationPlugin(),
|
|
40
42
|
],
|
|
41
43
|
}),
|
|
42
44
|
],
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { useOperationInvoker } from '@dxos/app-framework/react';
|
|
8
8
|
import { ComputeGraph } from '@dxos/conductor';
|
|
9
|
-
import { Filter, type
|
|
9
|
+
import { Filter, Obj, type Type } from '@dxos/echo';
|
|
10
10
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
11
11
|
import { Sheet } from '@dxos/plugin-sheet/types';
|
|
12
12
|
import { Diagram } from '@dxos/plugin-sketch/types';
|
|
13
13
|
import { useClient } from '@dxos/react-client';
|
|
14
|
-
import { type Space
|
|
14
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
15
15
|
import { IconButton, Input, Toolbar, useAsyncEffect } from '@dxos/react-ui';
|
|
16
16
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
17
17
|
import { Organization, Person, Task } from '@dxos/types';
|
|
@@ -23,43 +23,48 @@ import { SchemaTable } from './SchemaTable';
|
|
|
23
23
|
|
|
24
24
|
export type SpaceGeneratorProps = {
|
|
25
25
|
space: Space;
|
|
26
|
-
onCreateObjects?: (objects: Obj.
|
|
26
|
+
onCreateObjects?: (objects: Obj.Unknown[]) => void;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps) => {
|
|
30
|
-
const {
|
|
30
|
+
const { invokePromise } = useOperationInvoker();
|
|
31
31
|
const client = useClient();
|
|
32
32
|
const staticTypes = [Markdown.Document, Diagram.Diagram, Sheet.Sheet, ComputeGraph]; // TODO(burdon): Make extensible.
|
|
33
|
-
const recordTypes = [Organization.Organization, Person.Person, Task.Task];
|
|
33
|
+
const recordTypes: Type.Obj.Any[] = [Organization.Organization, Person.Person, Task.Task];
|
|
34
34
|
const [count, setCount] = useState(1);
|
|
35
35
|
const [info, setInfo] = useState<any>({});
|
|
36
36
|
const presets = useMemo(() => generator(), []);
|
|
37
37
|
|
|
38
|
+
// Register types.
|
|
39
|
+
useAsyncEffect(async () => {
|
|
40
|
+
await client.addTypes([...staticTypes, ...recordTypes, ...presets.schemas]);
|
|
41
|
+
}, [client]);
|
|
42
|
+
|
|
38
43
|
// Create type generators.
|
|
39
44
|
const typeMap = useMemo(() => {
|
|
40
|
-
client.addTypes([...staticTypes, ...recordTypes, ...presets.schemas]);
|
|
41
45
|
const recordGenerators = new Map<string, ObjectGenerator<any>>(
|
|
42
|
-
recordTypes.map((type) => [type.typename, createGenerator(client,
|
|
46
|
+
recordTypes.map((type) => [type.typename, createGenerator(client, invokePromise, type)]),
|
|
43
47
|
);
|
|
44
48
|
|
|
45
49
|
return new Map([...staticGenerators, ...presets.items, ...recordGenerators]);
|
|
46
|
-
}, [client, recordTypes]);
|
|
50
|
+
}, [client, recordTypes, invokePromise]);
|
|
47
51
|
|
|
48
52
|
// Query space to get info.
|
|
49
53
|
const updateInfo = async () => {
|
|
50
54
|
// Create schema map.
|
|
51
55
|
const echoSchema = await space.db.schemaRegistry.query().run();
|
|
52
|
-
const staticSchema = space.db.graph.schemaRegistry.
|
|
56
|
+
const staticSchema = await space.db.graph.schemaRegistry.query().run();
|
|
53
57
|
|
|
54
58
|
// Create object map.
|
|
55
|
-
const
|
|
59
|
+
const objects = await space.db.query(Filter.everything()).run();
|
|
56
60
|
const objectMap = sortKeys(
|
|
57
61
|
objects.reduce<Record<string, number>>((map, obj) => {
|
|
58
|
-
const type = getTypename(obj);
|
|
62
|
+
const type = Obj.getTypename(obj);
|
|
59
63
|
if (type) {
|
|
60
64
|
const count = map[type] ?? 0;
|
|
61
65
|
map[type] = count + 1;
|
|
62
66
|
}
|
|
67
|
+
|
|
63
68
|
return map;
|
|
64
69
|
}, {}),
|
|
65
70
|
);
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
pointsToRect,
|
|
37
37
|
rectToPoints,
|
|
38
38
|
} from '@dxos/react-ui-canvas-editor';
|
|
39
|
-
import {
|
|
39
|
+
import { View } from '@dxos/schema';
|
|
40
40
|
import { Message, Organization, Person, Project } from '@dxos/types';
|
|
41
41
|
import { range, trim } from '@dxos/util';
|
|
42
42
|
|
|
@@ -57,14 +57,19 @@ export enum PresetName {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export const generator = () => ({
|
|
60
|
-
schemas: [CanvasBoardType, Trigger.Trigger],
|
|
60
|
+
schemas: [CanvasBoardType, Trigger.Trigger] as any[],
|
|
61
61
|
types: Object.values(PresetName).map((name) => ({ typename: name })),
|
|
62
62
|
items: [
|
|
63
63
|
[
|
|
64
64
|
PresetName.DXOS_TEAM,
|
|
65
65
|
async (space, n, cb) => {
|
|
66
66
|
const objects = range(n, () => {
|
|
67
|
-
const org = space.db.add(
|
|
67
|
+
const org = space.db.add(
|
|
68
|
+
Obj.make(Organization.Organization, {
|
|
69
|
+
name: 'DXOS',
|
|
70
|
+
website: 'https://dxos.org',
|
|
71
|
+
}),
|
|
72
|
+
);
|
|
68
73
|
const doc = space.db.add(
|
|
69
74
|
Markdown.make({
|
|
70
75
|
name: 'DXOS Research',
|
|
@@ -74,7 +79,9 @@ export const generator = () => ({
|
|
|
74
79
|
|
|
75
80
|
const tag = space.db.add(Tag.make({ label: 'Investor' }));
|
|
76
81
|
const tagDxn = Obj.getDXN(tag).toString();
|
|
77
|
-
Obj.
|
|
82
|
+
Obj.change(doc, (d) => {
|
|
83
|
+
Obj.getMeta(d).tags = [tagDxn];
|
|
84
|
+
});
|
|
78
85
|
|
|
79
86
|
// space.db.add(
|
|
80
87
|
// Relation.make(HasSubject, {
|
|
@@ -85,9 +92,24 @@ export const generator = () => ({
|
|
|
85
92
|
// );
|
|
86
93
|
|
|
87
94
|
space.db.add(Obj.make(Person.Person, { fullName: 'Rich', organization: Ref.make(org) }, { tags: [tagDxn] }));
|
|
88
|
-
space.db.add(
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
space.db.add(
|
|
96
|
+
Obj.make(Person.Person, {
|
|
97
|
+
fullName: 'Josiah',
|
|
98
|
+
organization: Ref.make(org),
|
|
99
|
+
}),
|
|
100
|
+
);
|
|
101
|
+
space.db.add(
|
|
102
|
+
Obj.make(Person.Person, {
|
|
103
|
+
fullName: 'Dima',
|
|
104
|
+
organization: Ref.make(org),
|
|
105
|
+
}),
|
|
106
|
+
);
|
|
107
|
+
space.db.add(
|
|
108
|
+
Obj.make(Person.Person, {
|
|
109
|
+
fullName: 'Mykola',
|
|
110
|
+
organization: Ref.make(org),
|
|
111
|
+
}),
|
|
112
|
+
);
|
|
91
113
|
|
|
92
114
|
return doc;
|
|
93
115
|
});
|
|
@@ -174,38 +196,53 @@ export const generator = () => ({
|
|
|
174
196
|
);
|
|
175
197
|
|
|
176
198
|
const mailboxView = View.make({
|
|
177
|
-
name: 'Mailbox',
|
|
178
199
|
query: Query.select(
|
|
179
|
-
Filter.type(Message.Message, {
|
|
200
|
+
Filter.type(Message.Message, {
|
|
201
|
+
properties: { labels: Filter.contains('investor') },
|
|
202
|
+
}),
|
|
180
203
|
).options({
|
|
181
204
|
queues: [mailbox.queue.dxn.toString()],
|
|
182
205
|
}),
|
|
183
206
|
jsonSchema: Type.toJsonSchema(Message.Message),
|
|
184
|
-
presentation: Obj.make(Collection.Collection, { objects: [] }),
|
|
185
207
|
});
|
|
186
208
|
const contactsView = View.make({
|
|
187
|
-
name: 'Contacts',
|
|
188
209
|
query: contactsQuery,
|
|
189
210
|
jsonSchema: Type.toJsonSchema(Person.Person),
|
|
190
|
-
presentation: Obj.make(Collection.Collection, { objects: [] }),
|
|
191
211
|
});
|
|
192
212
|
const organizationsView = View.make({
|
|
193
|
-
name: 'Organizations',
|
|
194
213
|
query: organizationsQuery,
|
|
195
214
|
jsonSchema: Type.toJsonSchema(Organization.Organization),
|
|
196
|
-
presentation: Obj.make(Collection.Collection, { objects: [] }),
|
|
197
215
|
});
|
|
198
216
|
const notesView = View.make({
|
|
199
|
-
name: 'Notes',
|
|
200
217
|
query: notesQuery,
|
|
201
218
|
jsonSchema: Type.toJsonSchema(Markdown.Document),
|
|
202
|
-
presentation: Obj.make(Collection.Collection, { objects: [] }),
|
|
203
219
|
});
|
|
204
220
|
|
|
205
221
|
return space.db.add(
|
|
206
222
|
Project.make({
|
|
207
223
|
name: 'Investor Research',
|
|
208
|
-
|
|
224
|
+
columns: [
|
|
225
|
+
{
|
|
226
|
+
name: 'Mailbox',
|
|
227
|
+
view: Ref.make(mailboxView),
|
|
228
|
+
order: [],
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: 'Contacts',
|
|
232
|
+
view: Ref.make(contactsView),
|
|
233
|
+
order: [],
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: 'Organizations',
|
|
237
|
+
view: Ref.make(organizationsView),
|
|
238
|
+
order: [],
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
name: 'Notes',
|
|
242
|
+
view: Ref.make(notesView),
|
|
243
|
+
order: [],
|
|
244
|
+
},
|
|
245
|
+
],
|
|
209
246
|
}),
|
|
210
247
|
);
|
|
211
248
|
});
|
|
@@ -234,10 +271,24 @@ export const generator = () => ({
|
|
|
234
271
|
const append = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
|
|
235
272
|
|
|
236
273
|
builder
|
|
237
|
-
.createEdge({
|
|
274
|
+
.createEdge({
|
|
275
|
+
source: trigger.id,
|
|
276
|
+
target: gpt.id,
|
|
277
|
+
input: 'prompt',
|
|
278
|
+
output: 'bodyText',
|
|
279
|
+
})
|
|
238
280
|
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
239
|
-
.createEdge({
|
|
240
|
-
|
|
281
|
+
.createEdge({
|
|
282
|
+
source: queueId.id,
|
|
283
|
+
target: append.id,
|
|
284
|
+
input: 'id',
|
|
285
|
+
})
|
|
286
|
+
.createEdge({
|
|
287
|
+
source: gpt.id,
|
|
288
|
+
target: append.id,
|
|
289
|
+
output: 'messages',
|
|
290
|
+
input: 'items',
|
|
291
|
+
});
|
|
241
292
|
|
|
242
293
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
243
294
|
});
|
|
@@ -375,8 +426,17 @@ export const generator = () => ({
|
|
|
375
426
|
builder
|
|
376
427
|
.createEdge({ source: chat.id, target: gpt.id, input: 'prompt' })
|
|
377
428
|
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
378
|
-
.createEdge({
|
|
379
|
-
|
|
429
|
+
.createEdge({
|
|
430
|
+
source: queueId.id,
|
|
431
|
+
target: append.id,
|
|
432
|
+
input: 'id',
|
|
433
|
+
})
|
|
434
|
+
.createEdge({
|
|
435
|
+
source: gpt.id,
|
|
436
|
+
target: append.id,
|
|
437
|
+
output: 'messages',
|
|
438
|
+
input: 'items',
|
|
439
|
+
});
|
|
380
440
|
});
|
|
381
441
|
|
|
382
442
|
const computeModel = createComputeGraph(canvasModel);
|
|
@@ -500,9 +560,21 @@ export const generator = () => ({
|
|
|
500
560
|
const view = canvasModel.createNode(createSurface(position({ x: 12, y: 0 })));
|
|
501
561
|
|
|
502
562
|
builder
|
|
503
|
-
.createEdge({
|
|
504
|
-
|
|
505
|
-
|
|
563
|
+
.createEdge({
|
|
564
|
+
source: sourceCurrency.id,
|
|
565
|
+
target: converter.id,
|
|
566
|
+
input: 'from',
|
|
567
|
+
})
|
|
568
|
+
.createEdge({
|
|
569
|
+
source: targetCurrency.id,
|
|
570
|
+
target: converter.id,
|
|
571
|
+
input: 'to',
|
|
572
|
+
})
|
|
573
|
+
.createEdge({
|
|
574
|
+
source: converter.id,
|
|
575
|
+
target: view.id,
|
|
576
|
+
output: 'rate',
|
|
577
|
+
});
|
|
506
578
|
});
|
|
507
579
|
|
|
508
580
|
const computeModel = createComputeGraph(canvasModel);
|
|
@@ -530,7 +602,10 @@ export const generator = () => ({
|
|
|
530
602
|
const trigger = canvasModel.createNode(triggerShape);
|
|
531
603
|
// DXOS dev-null channel.
|
|
532
604
|
const channelId = canvasModel.createNode(
|
|
533
|
-
createConstant({
|
|
605
|
+
createConstant({
|
|
606
|
+
value: '1088569858767212554',
|
|
607
|
+
...position({ x: -10, y: 0 }),
|
|
608
|
+
}),
|
|
534
609
|
);
|
|
535
610
|
const queueId = canvasModel.createNode(
|
|
536
611
|
createConstant({
|
|
@@ -543,11 +618,31 @@ export const generator = () => ({
|
|
|
543
618
|
const queue = canvasModel.createNode(createQueue(position({ x: 0, y: 12 })));
|
|
544
619
|
|
|
545
620
|
builder
|
|
546
|
-
.createEdge({
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
621
|
+
.createEdge({
|
|
622
|
+
source: trigger.id,
|
|
623
|
+
target: converter.id,
|
|
624
|
+
input: 'tick',
|
|
625
|
+
})
|
|
626
|
+
.createEdge({
|
|
627
|
+
source: channelId.id,
|
|
628
|
+
target: converter.id,
|
|
629
|
+
input: 'channelId',
|
|
630
|
+
})
|
|
631
|
+
.createEdge({
|
|
632
|
+
source: queueId.id,
|
|
633
|
+
target: converter.id,
|
|
634
|
+
input: 'queueId',
|
|
635
|
+
})
|
|
636
|
+
.createEdge({
|
|
637
|
+
source: converter.id,
|
|
638
|
+
target: view.id,
|
|
639
|
+
output: 'newMessages',
|
|
640
|
+
})
|
|
641
|
+
.createEdge({
|
|
642
|
+
source: queueId.id,
|
|
643
|
+
target: queue.id,
|
|
644
|
+
input: 'input',
|
|
645
|
+
});
|
|
551
646
|
|
|
552
647
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
553
648
|
});
|
|
@@ -650,7 +745,12 @@ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
|
650
745
|
builder
|
|
651
746
|
.createEdge({ source: queueId.id, target: append.id, input: 'id' })
|
|
652
747
|
.createEdge({ source: template.id, target: append.id, input: 'items' })
|
|
653
|
-
.createEdge({
|
|
748
|
+
.createEdge({
|
|
749
|
+
source: trigger.id,
|
|
750
|
+
target: template.id,
|
|
751
|
+
output: triggerOutputName,
|
|
752
|
+
input: 'type',
|
|
753
|
+
})
|
|
654
754
|
.createEdge({
|
|
655
755
|
source: random.id,
|
|
656
756
|
target: template.id,
|
|
@@ -667,6 +767,7 @@ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
|
667
767
|
|
|
668
768
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
669
769
|
invariant(templateComputeNode, 'Template compute node was not created.');
|
|
770
|
+
// NOTE: These are plain object mutations during model construction, not ECHO object mutations.
|
|
670
771
|
templateComputeNode.value = ['{', ' "@type": "{{type}}",', ' "id": "@{{changeId}}"', '}'].join('\n');
|
|
671
772
|
templateComputeNode.inputSchema = Type.toJsonSchema(Schema.Struct({ type: Schema.String, changeId: Schema.String }));
|
|
672
773
|
attachTrigger(functionTrigger, computeModel);
|
|
@@ -706,15 +807,25 @@ const setupQueue = (
|
|
|
706
807
|
|
|
707
808
|
const attachTrigger = (functionTrigger: Trigger.Trigger | undefined, computeModel: ComputeGraphModel) => {
|
|
708
809
|
invariant(functionTrigger);
|
|
709
|
-
functionTrigger.function = Ref.make(computeModel.root);
|
|
710
810
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
|
|
711
|
-
functionTrigger
|
|
811
|
+
Obj.change(functionTrigger, (t) => {
|
|
812
|
+
t.function = Ref.make(computeModel.root);
|
|
813
|
+
t.inputNodeId = inputNode.id;
|
|
814
|
+
});
|
|
712
815
|
};
|
|
713
816
|
|
|
714
|
-
type RawPositionInput = {
|
|
817
|
+
type RawPositionInput = {
|
|
818
|
+
centerX: number;
|
|
819
|
+
centerY: number;
|
|
820
|
+
width: number;
|
|
821
|
+
height: number;
|
|
822
|
+
};
|
|
715
823
|
|
|
716
824
|
const rawPosition = (args: RawPositionInput) => {
|
|
717
|
-
return {
|
|
825
|
+
return {
|
|
826
|
+
center: { x: args.centerX, y: args.centerY },
|
|
827
|
+
size: { width: args.width, height: args.height },
|
|
828
|
+
};
|
|
718
829
|
};
|
|
719
830
|
|
|
720
831
|
const position = (rect: { x: number; y: number; width?: number; height?: number }) => {
|
|
@@ -722,7 +833,10 @@ const position = (rect: { x: number; y: number; width?: number; height?: number
|
|
|
722
833
|
const [center, size] = rectToPoints({ width: 0, height: 0, ...rect });
|
|
723
834
|
const { x, y, width, height } = pointsToRect([pointMultiply(center, snap), pointMultiply(size, snap)]);
|
|
724
835
|
if (width && height) {
|
|
725
|
-
return {
|
|
836
|
+
return {
|
|
837
|
+
center: { x, y },
|
|
838
|
+
size: width && height ? { width, height } : undefined,
|
|
839
|
+
};
|
|
726
840
|
} else {
|
|
727
841
|
return { center: { x, y } };
|
|
728
842
|
}
|
|
@@ -9,12 +9,12 @@ import { Obj } from '@dxos/echo';
|
|
|
9
9
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
10
10
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
11
11
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
12
|
-
import { mx } from '@dxos/
|
|
12
|
+
import { mx } from '@dxos/ui-theme';
|
|
13
13
|
|
|
14
14
|
// TODO(burdon): Create generic container with wireframe mode.
|
|
15
15
|
export type WireframeProps = ThemedClassName<{
|
|
16
|
+
object: Obj.Unknown;
|
|
16
17
|
label?: string;
|
|
17
|
-
object: Obj.Any;
|
|
18
18
|
}>;
|
|
19
19
|
|
|
20
20
|
// TODO(burdon): Make focusable and attendable with input.
|
package/src/components/index.ts
CHANGED
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { lazy } from 'react';
|
|
6
|
+
import { type FC } from 'react';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
import { type DebugGraphProps } from './DebugGraph';
|
|
9
|
+
|
|
10
|
+
export const DebugGraph: ReturnType<typeof lazy<FC<DebugGraphProps>>> = lazy(() => import('./DebugGraph'));
|
|
8
11
|
export const DevtoolsOverviewContainer = lazy(() => import('./DevtoolsOverviewContainer'));
|
|
9
12
|
export const SpaceGenerator = lazy(() => import('./SpaceGenerator'));
|
|
10
13
|
|
package/src/meta.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
export const meta:
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
9
|
id: 'dxos.org/plugin/debug',
|
|
10
10
|
name: 'Debug',
|
|
11
11
|
description: trim`
|
package/src/types.ts
CHANGED
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
5
6
|
import * as Schema from 'effect/Schema';
|
|
6
7
|
import { type Context, createContext } from 'react';
|
|
7
8
|
|
|
9
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
10
|
import type { TimerCallback, TimerOptions } from '@dxos/async';
|
|
9
11
|
|
|
12
|
+
import { meta } from './meta';
|
|
13
|
+
|
|
10
14
|
export type DebugContextType = {
|
|
11
15
|
running: boolean;
|
|
12
16
|
start: (cb: TimerCallback, options: TimerOptions) => void;
|
|
@@ -27,6 +31,10 @@ export const DebugSettingsSchema = Schema.mutable(
|
|
|
27
31
|
|
|
28
32
|
export interface DebugSettingsProps extends Schema.Schema.Type<typeof DebugSettingsSchema> {}
|
|
29
33
|
|
|
34
|
+
export namespace DebugCapabilities {
|
|
35
|
+
export const Settings = Capability.make<Atom.Writable<DebugSettingsProps>>(`${meta.id}/capability/settings`);
|
|
36
|
+
}
|
|
37
|
+
|
|
30
38
|
export namespace Devtools {
|
|
31
39
|
// TODO(wittjosiah): Cannot use slashes in ids until we have a router which decouples ids from url paths.
|
|
32
40
|
export const id = 'dxos.org.plugin.debug.devtools';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// src/components/DebugGraph.tsx
|
|
2
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { Tree } from "@dxos/devtools";
|
|
5
|
-
var DebugGraph = ({ graph, root }) => {
|
|
6
|
-
var _effect = _useSignals();
|
|
7
|
-
try {
|
|
8
|
-
return /* @__PURE__ */ React.createElement(Tree, {
|
|
9
|
-
data: graph.toJSON(root)
|
|
10
|
-
});
|
|
11
|
-
} finally {
|
|
12
|
-
_effect.f();
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
var DebugGraph_default = DebugGraph;
|
|
16
|
-
export {
|
|
17
|
-
DebugGraph,
|
|
18
|
-
DebugGraph_default as default
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=DebugGraph-EDOH6R2G.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/DebugGraph.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nimport { Tree } from '@dxos/devtools';\nimport { type Graph } from '@dxos/plugin-graph';\n\nexport const DebugGraph: FC<{ graph: Graph; root: string }> = ({ graph, root }) => {\n return <Tree data={graph.toJSON(root)} />;\n};\n\nexport default DebugGraph;\n"],
|
|
5
|
-
"mappings": ";;AAIA,OAAOA,WAAwB;AAE/B,SAASC,YAAY;AAGd,IAAMC,aAAiD,CAAC,EAAEC,OAAOC,KAAI,MAAE;;;AAC5E,WAAO,sBAAA,cAACC,MAAAA;MAAKC,MAAMH,MAAMI,OAAOH,IAAAA;;;;;AAClC;AAEA,IAAA,qBAAeF;",
|
|
6
|
-
"names": ["React", "Tree", "DebugGraph", "graph", "root", "Tree", "data", "toJSON"]
|
|
7
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// src/components/DevtoolsOverviewContainer.tsx
|
|
2
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { Surface } from "@dxos/app-framework/react";
|
|
5
|
-
import { StatsPanel, useStats } from "@dxos/devtools";
|
|
6
|
-
var DevtoolsOverviewContainer = () => {
|
|
7
|
-
var _effect = _useSignals();
|
|
8
|
-
try {
|
|
9
|
-
const [stats, refreshStats] = useStats();
|
|
10
|
-
return /* @__PURE__ */ React.createElement(StatsPanel, {
|
|
11
|
-
stats,
|
|
12
|
-
onRefresh: refreshStats
|
|
13
|
-
}, /* @__PURE__ */ React.createElement(Surface, {
|
|
14
|
-
role: "devtools-overview"
|
|
15
|
-
}));
|
|
16
|
-
} finally {
|
|
17
|
-
_effect.f();
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
var DevtoolsOverviewContainer_default = DevtoolsOverviewContainer;
|
|
21
|
-
export {
|
|
22
|
-
DevtoolsOverviewContainer,
|
|
23
|
-
DevtoolsOverviewContainer_default as default
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=DevtoolsOverviewContainer-JXVZVPHN.mjs.map
|