@dxos/plugin-debug 0.8.4-main.e8ec1fe → 0.8.4-main.effb148878
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/neutral/DebugGraph-G4FWS57E.mjs +15 -0
- package/dist/lib/neutral/DebugGraph-G4FWS57E.mjs.map +7 -0
- package/dist/lib/neutral/DebugObjectPanel-UJ63CV25.mjs +59 -0
- package/dist/lib/neutral/DebugObjectPanel-UJ63CV25.mjs.map +7 -0
- package/dist/lib/neutral/DebugPlugin.mjs +47 -0
- package/dist/lib/neutral/DebugPlugin.mjs.map +7 -0
- package/dist/lib/neutral/DebugPlugin.node.mjs +18 -0
- package/dist/lib/neutral/DebugPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/DebugPlugin.workerd.mjs +12 -0
- package/dist/lib/neutral/DebugPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/DebugSettings-Z3XADRNK.mjs +224 -0
- package/dist/lib/neutral/DebugSettings-Z3XADRNK.mjs.map +7 -0
- package/dist/lib/neutral/DebugSpaceObjectsPanel-NISULU6U.mjs +34 -0
- package/dist/lib/neutral/DebugSpaceObjectsPanel-NISULU6U.mjs.map +7 -0
- package/dist/lib/neutral/DebugStatus-YB3KFP7G.mjs +121 -0
- package/dist/lib/neutral/DebugStatus-YB3KFP7G.mjs.map +7 -0
- package/dist/lib/neutral/DevtoolsOverviewContainer-YX7Z3D2H.mjs +23 -0
- package/dist/lib/neutral/DevtoolsOverviewContainer-YX7Z3D2H.mjs.map +7 -0
- package/dist/lib/neutral/GithubPanel-QJKDJRVQ.mjs +177 -0
- package/dist/lib/neutral/GithubPanel-QJKDJRVQ.mjs.map +7 -0
- package/dist/lib/neutral/SpaceGenerator-IQLBDY6R.mjs +143 -0
- package/dist/lib/neutral/SpaceGenerator-IQLBDY6R.mjs.map +7 -0
- package/dist/lib/neutral/Wireframe-WD7S2AUU.mjs +52 -0
- package/dist/lib/neutral/Wireframe-WD7S2AUU.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-ZNMWIDDF.mjs +598 -0
- package/dist/lib/neutral/app-graph-builder-ZNMWIDDF.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +15 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/{browser/chunk-SRV2AIGJ.mjs → neutral/chunk-NFIOTQRZ.mjs} +30 -9
- package/dist/lib/neutral/chunk-NFIOTQRZ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-SAJFZGX5.mjs +41 -0
- package/dist/lib/neutral/chunk-SAJFZGX5.mjs.map +7 -0
- package/dist/lib/{browser/SpaceGenerator-46TAISVE.mjs → neutral/components/index.mjs} +322 -496
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +23 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +18 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +12 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-context-MUZ3KVLU.mjs +17 -0
- package/dist/lib/neutral/react-context-MUZ3KVLU.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-T4NYONZ7.mjs +419 -0
- package/dist/lib/neutral/react-surface-T4NYONZ7.mjs.map +7 -0
- package/dist/lib/neutral/settings-MPM6YUP4.mjs +28 -0
- package/dist/lib/neutral/settings-MPM6YUP4.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +90 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +14 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/src/DebugPlugin.d.ts +4 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/DebugPlugin.node.d.ts +5 -0
- package/dist/types/src/DebugPlugin.node.d.ts.map +1 -0
- package/dist/types/src/DebugPlugin.test.d.ts +2 -0
- package/dist/types/src/DebugPlugin.test.d.ts.map +1 -0
- package/dist/types/src/DebugPlugin.workerd.d.ts +5 -0
- package/dist/types/src/DebugPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +8 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context.d.ts +4 -2
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +7 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +5 -2
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings/DebugSettings.d.ts +11 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts +105 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings/index.d.ts +2 -0
- package/dist/types/src/components/DebugSettings/index.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 +4 -5
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/draw-util.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 +1 -4
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -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 +2 -0
- package/dist/types/src/containers/DebugGraph/index.d.ts.map +1 -0
- package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts +6 -0
- package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -0
- package/dist/types/src/containers/DebugObjectPanel/index.d.ts +2 -0
- package/dist/types/src/containers/DebugObjectPanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +5 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts +2 -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 +2 -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 +2 -0
- package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/GithubPanel/GithubComponent.d.ts +15 -0
- package/dist/types/src/containers/GithubPanel/GithubComponent.d.ts.map +1 -0
- package/dist/types/src/containers/GithubPanel/GithubComponent.stories.d.ts +105 -0
- package/dist/types/src/containers/GithubPanel/GithubComponent.stories.d.ts.map +1 -0
- package/dist/types/src/containers/GithubPanel/GithubPanel.d.ts +3 -0
- package/dist/types/src/containers/GithubPanel/GithubPanel.d.ts.map +1 -0
- package/dist/types/src/containers/GithubPanel/index.d.ts +2 -0
- package/dist/types/src/containers/GithubPanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts +11 -0
- package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts.map +1 -0
- package/dist/types/src/containers/SpaceGenerator/index.d.ts +2 -0
- package/dist/types/src/containers/SpaceGenerator/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/Wireframe}/Wireframe.d.ts +1 -1
- package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -0
- package/dist/types/src/containers/Wireframe/index.d.ts +2 -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/index.d.ts +1 -1
- package/dist/types/src/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/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +86 -59
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +8 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +69 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +134 -76
- package/src/DebugPlugin.node.ts +18 -0
- package/src/DebugPlugin.test.ts +29 -0
- package/src/DebugPlugin.tsx +28 -34
- package/src/DebugPlugin.workerd.ts +12 -0
- package/src/capabilities/app-graph-builder.ts +381 -388
- package/src/capabilities/index.ts +5 -5
- package/src/capabilities/react-context.tsx +16 -7
- package/src/capabilities/react-surface.tsx +376 -356
- package/src/capabilities/settings.ts +24 -12
- package/src/components/DebugSettings/DebugSettings.stories.tsx +36 -0
- package/src/components/DebugSettings/DebugSettings.tsx +262 -0
- package/src/components/DebugSettings/index.ts +5 -0
- package/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.tsx +2 -2
- package/src/components/SchemaTable/index.ts +5 -0
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +30 -34
- package/src/components/SpaceGenerator/draw-util.ts +8 -8
- package/src/components/SpaceGenerator/index.ts +2 -3
- package/src/components/SpaceGenerator/presets.ts +209 -112
- package/src/components/index.ts +4 -8
- package/src/containers/DebugGraph/DebugGraph.tsx +14 -0
- package/src/containers/DebugGraph/index.ts +5 -0
- package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +76 -0
- package/src/containers/DebugObjectPanel/index.ts +5 -0
- package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +47 -0
- package/src/containers/DebugSpaceObjectsPanel/index.ts +5 -0
- package/src/{components → containers/DebugStatus}/DebugStatus.tsx +41 -19
- package/src/containers/DebugStatus/index.ts +5 -0
- package/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx +25 -0
- package/src/containers/DevtoolsOverviewContainer/index.ts +5 -0
- package/src/containers/GithubPanel/GithubComponent.stories.tsx +38 -0
- package/src/containers/GithubPanel/GithubComponent.tsx +192 -0
- package/src/containers/GithubPanel/GithubPanel.tsx +17 -0
- package/src/containers/GithubPanel/index.ts +5 -0
- package/src/containers/SpaceGenerator/SpaceGenerator.tsx +126 -0
- package/src/containers/SpaceGenerator/index.ts +5 -0
- package/src/{components → containers/Wireframe}/Wireframe.tsx +6 -10
- package/src/containers/Wireframe/index.ts +5 -0
- package/src/containers/index.ts +14 -0
- package/src/index.ts +1 -1
- package/src/meta.ts +24 -5
- package/src/plugin.ts +10 -0
- package/src/translations.ts +82 -58
- package/src/types/Settings.ts +16 -0
- package/src/{types.ts → types/index.ts} +20 -11
- 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/DevtoolsOverviewContainer-JXVZVPHN.mjs.map +0 -7
- 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 +0 -20
- package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -130
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- 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/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 +0 -7
- 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 +0 -9
- 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/dist/types/src/types.d.ts +0 -63
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/components/Container.tsx +0 -15
- package/src/components/DebugGraph.tsx +0 -14
- package/src/components/DebugObjectPanel.tsx +0 -33
- package/src/components/DebugSettings.tsx +0 -180
- package/src/components/DevtoolsOverviewContainer.tsx +0 -20
- 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
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { AgentPrompt, WebSearchBlueprint } from '@dxos/assistant-toolkit';
|
|
8
|
+
import { Routine, Trigger, Operation } from '@dxos/compute';
|
|
9
9
|
import { type ComputeGraphModel, NODE_INPUT } from '@dxos/conductor';
|
|
10
|
-
import {
|
|
11
|
-
import { Trigger, serializeFunction } from '@dxos/functions';
|
|
10
|
+
import { Feed, Filter, JsonSchema, Key, Obj, Query, type QueryAST, Ref, Tag } from '@dxos/echo';
|
|
12
11
|
import { invariant } from '@dxos/invariant';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
12
|
+
import { EchoURI } from '@dxos/keys';
|
|
13
|
+
import { InboxOperation } from '@dxos/plugin-inbox';
|
|
14
|
+
import { Mailbox } from '@dxos/plugin-inbox';
|
|
15
|
+
import { Markdown } from '@dxos/plugin-markdown';
|
|
16
16
|
import { type Space } from '@dxos/react-client/echo';
|
|
17
17
|
import {
|
|
18
18
|
type ComputeShape,
|
|
@@ -20,24 +20,18 @@ import {
|
|
|
20
20
|
createChat,
|
|
21
21
|
createComputeGraph,
|
|
22
22
|
createConstant,
|
|
23
|
+
createFeed,
|
|
23
24
|
createFunction,
|
|
24
25
|
createGpt,
|
|
25
|
-
createQueue,
|
|
26
26
|
createRandom,
|
|
27
27
|
createSurface,
|
|
28
28
|
createTemplate,
|
|
29
29
|
createText,
|
|
30
30
|
createTrigger,
|
|
31
31
|
} from '@dxos/react-ui-canvas-compute';
|
|
32
|
-
import {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
pointMultiply,
|
|
36
|
-
pointsToRect,
|
|
37
|
-
rectToPoints,
|
|
38
|
-
} from '@dxos/react-ui-canvas-editor';
|
|
39
|
-
import { Collection, View } from '@dxos/schema';
|
|
40
|
-
import { Message, Organization, Person, Project } from '@dxos/types';
|
|
32
|
+
import { CanvasBoard, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from '@dxos/react-ui-canvas-editor';
|
|
33
|
+
import { ViewModel } from '@dxos/schema';
|
|
34
|
+
import { Message, Organization, Person, Pipeline } from '@dxos/types';
|
|
41
35
|
import { range, trim } from '@dxos/util';
|
|
42
36
|
|
|
43
37
|
import { type ObjectGenerator } from './ObjectGenerator';
|
|
@@ -57,14 +51,19 @@ export enum PresetName {
|
|
|
57
51
|
}
|
|
58
52
|
|
|
59
53
|
export const generator = () => ({
|
|
60
|
-
schemas: [
|
|
54
|
+
schemas: [CanvasBoard.CanvasBoard, Trigger.Trigger] as any[],
|
|
61
55
|
types: Object.values(PresetName).map((name) => ({ typename: name })),
|
|
62
56
|
items: [
|
|
63
57
|
[
|
|
64
58
|
PresetName.DXOS_TEAM,
|
|
65
59
|
async (space, n, cb) => {
|
|
66
60
|
const objects = range(n, () => {
|
|
67
|
-
const org = space.db.add(
|
|
61
|
+
const org = space.db.add(
|
|
62
|
+
Obj.make(Organization.Organization, {
|
|
63
|
+
name: 'DXOS',
|
|
64
|
+
website: 'https://dxos.org',
|
|
65
|
+
}),
|
|
66
|
+
);
|
|
68
67
|
const doc = space.db.add(
|
|
69
68
|
Markdown.make({
|
|
70
69
|
name: 'DXOS Research',
|
|
@@ -73,8 +72,10 @@ export const generator = () => ({
|
|
|
73
72
|
);
|
|
74
73
|
|
|
75
74
|
const tag = space.db.add(Tag.make({ label: 'Investor' }));
|
|
76
|
-
const
|
|
77
|
-
Obj.
|
|
75
|
+
const tagUri = Obj.getURI(tag);
|
|
76
|
+
Obj.update(doc, (doc) => {
|
|
77
|
+
Obj.getMeta(doc).tags = [tagUri];
|
|
78
|
+
});
|
|
78
79
|
|
|
79
80
|
// space.db.add(
|
|
80
81
|
// Relation.make(HasSubject, {
|
|
@@ -84,10 +85,27 @@ export const generator = () => ({
|
|
|
84
85
|
// }),
|
|
85
86
|
// );
|
|
86
87
|
|
|
87
|
-
space.db.add(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
space.db.add(
|
|
88
|
+
space.db.add(
|
|
89
|
+
Obj.make(Person.Person, { [Obj.Meta]: { tags: [tagUri] }, fullName: 'Rich', organization: Ref.make(org) }),
|
|
90
|
+
);
|
|
91
|
+
space.db.add(
|
|
92
|
+
Obj.make(Person.Person, {
|
|
93
|
+
fullName: 'Josiah',
|
|
94
|
+
organization: Ref.make(org),
|
|
95
|
+
}),
|
|
96
|
+
);
|
|
97
|
+
space.db.add(
|
|
98
|
+
Obj.make(Person.Person, {
|
|
99
|
+
fullName: 'Dima',
|
|
100
|
+
organization: Ref.make(org),
|
|
101
|
+
}),
|
|
102
|
+
);
|
|
103
|
+
space.db.add(
|
|
104
|
+
Obj.make(Person.Person, {
|
|
105
|
+
fullName: 'Mykola',
|
|
106
|
+
organization: Ref.make(org),
|
|
107
|
+
}),
|
|
108
|
+
);
|
|
91
109
|
|
|
92
110
|
return doc;
|
|
93
111
|
});
|
|
@@ -98,46 +116,34 @@ export const generator = () => ({
|
|
|
98
116
|
[
|
|
99
117
|
PresetName.ORG_RESEARCH_PROJECT,
|
|
100
118
|
async (space, n, cb) => {
|
|
101
|
-
const
|
|
119
|
+
const mailboxes = await space.db.query(Filter.type(Mailbox.Mailbox)).run();
|
|
120
|
+
const mailbox = mailboxes[0];
|
|
121
|
+
invariant(mailbox, 'Mailbox not found');
|
|
122
|
+
const mailboxFeed = await mailbox.feed?.tryLoad();
|
|
123
|
+
invariant(mailboxFeed, 'Mailbox missing feed reference');
|
|
124
|
+
const queueDxn = Feed.getQueueUri(mailboxFeed);
|
|
125
|
+
invariant(queueDxn, 'Mailbox feed missing queue DXN key');
|
|
102
126
|
const tag = await space.db.query(Filter.type(Tag.Tag, { label: 'Investor' })).first();
|
|
103
|
-
const
|
|
127
|
+
const tagUri = Obj.getURI(tag);
|
|
104
128
|
|
|
105
129
|
const objects = range(n, () => {
|
|
106
|
-
const contactsQuery = Query.select(Filter.type(Person.Person)).select(Filter.tag(
|
|
107
|
-
const organizationsQuery = Query.select(Filter.type(Organization.Organization)).select(Filter.tag(
|
|
108
|
-
const notesQuery = Query.select(Filter.type(Markdown.Document)).select(Filter.tag(
|
|
109
|
-
|
|
110
|
-
space.db.add(
|
|
111
|
-
Trigger.make({
|
|
112
|
-
enabled: true,
|
|
113
|
-
spec: {
|
|
114
|
-
kind: 'timer',
|
|
115
|
-
cron: '* * * * *', // Every minute.
|
|
116
|
-
},
|
|
117
|
-
function: Ref.make(serializeFunction(gmail.sync)),
|
|
118
|
-
input: {
|
|
119
|
-
mailboxId: Obj.getDXN(mailbox).toString(),
|
|
120
|
-
},
|
|
121
|
-
}),
|
|
122
|
-
);
|
|
130
|
+
const contactsQuery = Query.select(Filter.type(Person.Person)).select(Filter.tag(tagUri));
|
|
131
|
+
const organizationsQuery = Query.select(Filter.type(Organization.Organization)).select(Filter.tag(tagUri));
|
|
132
|
+
const notesQuery = Query.select(Filter.type(Markdown.Document)).select(Filter.tag(tagUri));
|
|
123
133
|
|
|
124
134
|
space.db.add(
|
|
125
135
|
Trigger.make({
|
|
126
136
|
enabled: true,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
kind: 'queue',
|
|
130
|
-
queue: mailbox.queue.dxn.toString(),
|
|
131
|
-
},
|
|
132
|
-
function: Ref.make(serializeFunction(EntityExtraction.extract)),
|
|
137
|
+
spec: Trigger.specTimer('* * * * *'), // Every minute.
|
|
138
|
+
function: Ref.make(Operation.serialize(InboxOperation.GoogleMailSync)),
|
|
133
139
|
input: {
|
|
134
|
-
|
|
140
|
+
mailbox: Ref.make(mailbox),
|
|
135
141
|
},
|
|
136
142
|
}),
|
|
137
143
|
);
|
|
138
144
|
|
|
139
145
|
const researchPrompt = space.db.add(
|
|
140
|
-
|
|
146
|
+
Routine.make({
|
|
141
147
|
name: 'Research',
|
|
142
148
|
description: 'Research organization',
|
|
143
149
|
input: Schema.Struct({
|
|
@@ -152,20 +158,15 @@ export const generator = () => ({
|
|
|
152
158
|
Create a research note for it at the end.
|
|
153
159
|
NOTE: Do mocked reseach (set mockSearch to true).
|
|
154
160
|
`,
|
|
155
|
-
blueprints: [Ref.make(
|
|
161
|
+
blueprints: [Ref.make(WebSearchBlueprint.make())],
|
|
156
162
|
}),
|
|
157
163
|
);
|
|
158
164
|
|
|
159
165
|
space.db.add(
|
|
160
166
|
Trigger.make({
|
|
161
167
|
enabled: true,
|
|
162
|
-
spec:
|
|
163
|
-
|
|
164
|
-
query: {
|
|
165
|
-
ast: organizationsQuery.ast,
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
function: Ref.make(serializeFunction(Agent.prompt)),
|
|
168
|
+
spec: Trigger.specSubscription(organizationsQuery),
|
|
169
|
+
function: Ref.make(Operation.serialize(AgentPrompt)),
|
|
169
170
|
input: {
|
|
170
171
|
prompt: Ref.make(researchPrompt),
|
|
171
172
|
input: '{{event.subject}}',
|
|
@@ -173,39 +174,54 @@ export const generator = () => ({
|
|
|
173
174
|
}),
|
|
174
175
|
);
|
|
175
176
|
|
|
176
|
-
const mailboxView =
|
|
177
|
-
name: 'Mailbox',
|
|
177
|
+
const mailboxView = ViewModel.make({
|
|
178
178
|
query: Query.select(
|
|
179
|
-
Filter.type(Message.Message, {
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
Filter.type(Message.Message, {
|
|
180
|
+
properties: { labels: Filter.contains('investor') },
|
|
181
|
+
}),
|
|
182
|
+
).from({
|
|
183
|
+
feeds: [queueDxn],
|
|
182
184
|
}),
|
|
183
|
-
jsonSchema:
|
|
184
|
-
presentation: Obj.make(Collection.Collection, { objects: [] }),
|
|
185
|
+
jsonSchema: JsonSchema.toJsonSchema(Message.Message),
|
|
185
186
|
});
|
|
186
|
-
const contactsView =
|
|
187
|
-
name: 'Contacts',
|
|
187
|
+
const contactsView = ViewModel.make({
|
|
188
188
|
query: contactsQuery,
|
|
189
|
-
jsonSchema:
|
|
190
|
-
presentation: Obj.make(Collection.Collection, { objects: [] }),
|
|
189
|
+
jsonSchema: JsonSchema.toJsonSchema(Person.Person),
|
|
191
190
|
});
|
|
192
|
-
const organizationsView =
|
|
193
|
-
name: 'Organizations',
|
|
191
|
+
const organizationsView = ViewModel.make({
|
|
194
192
|
query: organizationsQuery,
|
|
195
|
-
jsonSchema:
|
|
196
|
-
presentation: Obj.make(Collection.Collection, { objects: [] }),
|
|
193
|
+
jsonSchema: JsonSchema.toJsonSchema(Organization.Organization),
|
|
197
194
|
});
|
|
198
|
-
const notesView =
|
|
199
|
-
name: 'Notes',
|
|
195
|
+
const notesView = ViewModel.make({
|
|
200
196
|
query: notesQuery,
|
|
201
|
-
jsonSchema:
|
|
202
|
-
presentation: Obj.make(Collection.Collection, { objects: [] }),
|
|
197
|
+
jsonSchema: JsonSchema.toJsonSchema(Markdown.Document),
|
|
203
198
|
});
|
|
204
199
|
|
|
205
200
|
return space.db.add(
|
|
206
|
-
|
|
201
|
+
Pipeline.make({
|
|
207
202
|
name: 'Investor Research',
|
|
208
|
-
|
|
203
|
+
columns: [
|
|
204
|
+
{
|
|
205
|
+
name: 'Mailbox',
|
|
206
|
+
view: Ref.make(mailboxView),
|
|
207
|
+
order: [],
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: 'Contacts',
|
|
211
|
+
view: Ref.make(contactsView),
|
|
212
|
+
order: [],
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
name: 'Organizations',
|
|
216
|
+
view: Ref.make(organizationsView),
|
|
217
|
+
order: [],
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
name: 'Notes',
|
|
221
|
+
view: Ref.make(notesView),
|
|
222
|
+
order: [],
|
|
223
|
+
},
|
|
224
|
+
],
|
|
209
225
|
}),
|
|
210
226
|
);
|
|
211
227
|
});
|
|
@@ -234,10 +250,24 @@ export const generator = () => ({
|
|
|
234
250
|
const append = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
|
|
235
251
|
|
|
236
252
|
builder
|
|
237
|
-
.createEdge({
|
|
253
|
+
.createEdge({
|
|
254
|
+
source: trigger.id,
|
|
255
|
+
target: gpt.id,
|
|
256
|
+
input: 'prompt',
|
|
257
|
+
output: 'bodyText',
|
|
258
|
+
})
|
|
238
259
|
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
239
|
-
.createEdge({
|
|
240
|
-
|
|
260
|
+
.createEdge({
|
|
261
|
+
source: queueId.id,
|
|
262
|
+
target: append.id,
|
|
263
|
+
input: 'id',
|
|
264
|
+
})
|
|
265
|
+
.createEdge({
|
|
266
|
+
source: gpt.id,
|
|
267
|
+
target: append.id,
|
|
268
|
+
output: 'messages',
|
|
269
|
+
input: 'items',
|
|
270
|
+
});
|
|
241
271
|
|
|
242
272
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
243
273
|
});
|
|
@@ -262,7 +292,7 @@ export const generator = () => ({
|
|
|
262
292
|
'subscription',
|
|
263
293
|
(triggerSpec) =>
|
|
264
294
|
(triggerSpec.query = {
|
|
265
|
-
ast: Query.select(Filter.typename('dxos.
|
|
295
|
+
ast: Query.select(Filter.typename('org.dxos.type.chess')).ast as Obj.Mutable<QueryAST.Query>,
|
|
266
296
|
}),
|
|
267
297
|
'type',
|
|
268
298
|
);
|
|
@@ -347,7 +377,7 @@ export const generator = () => ({
|
|
|
347
377
|
// const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
348
378
|
// invariant(templateComputeNode, 'Template compute node was not created.');
|
|
349
379
|
// templateComputeNode.value = templateContent.join('\n');
|
|
350
|
-
// templateComputeNode.inputSchema =
|
|
380
|
+
// templateComputeNode.inputSchema = JsonSchema.toJsonSchema(EmailTriggerOutput);
|
|
351
381
|
|
|
352
382
|
// attachTrigger(functionTrigger, computeModel);
|
|
353
383
|
|
|
@@ -375,8 +405,17 @@ export const generator = () => ({
|
|
|
375
405
|
builder
|
|
376
406
|
.createEdge({ source: chat.id, target: gpt.id, input: 'prompt' })
|
|
377
407
|
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
378
|
-
.createEdge({
|
|
379
|
-
|
|
408
|
+
.createEdge({
|
|
409
|
+
source: queueId.id,
|
|
410
|
+
target: append.id,
|
|
411
|
+
input: 'id',
|
|
412
|
+
})
|
|
413
|
+
.createEdge({
|
|
414
|
+
source: gpt.id,
|
|
415
|
+
target: append.id,
|
|
416
|
+
output: 'messages',
|
|
417
|
+
input: 'items',
|
|
418
|
+
});
|
|
380
419
|
});
|
|
381
420
|
|
|
382
421
|
const computeModel = createComputeGraph(canvasModel);
|
|
@@ -472,7 +511,7 @@ export const generator = () => ({
|
|
|
472
511
|
// invariant(templateComputeNode, 'Template compute node was not created.');
|
|
473
512
|
// templateComputeNode.value = templateContent.join('\n');
|
|
474
513
|
// const extendedSchema = Schema.extend(EmailTriggerOutput, Schema.Struct({ text: Schema.String }));
|
|
475
|
-
// templateComputeNode.inputSchema =
|
|
514
|
+
// templateComputeNode.inputSchema = JsonSchema.toJsonSchema(extendedSchema);
|
|
476
515
|
|
|
477
516
|
// attachTrigger(functionTrigger, computeModel);
|
|
478
517
|
|
|
@@ -500,9 +539,21 @@ export const generator = () => ({
|
|
|
500
539
|
const view = canvasModel.createNode(createSurface(position({ x: 12, y: 0 })));
|
|
501
540
|
|
|
502
541
|
builder
|
|
503
|
-
.createEdge({
|
|
504
|
-
|
|
505
|
-
|
|
542
|
+
.createEdge({
|
|
543
|
+
source: sourceCurrency.id,
|
|
544
|
+
target: converter.id,
|
|
545
|
+
input: 'from',
|
|
546
|
+
})
|
|
547
|
+
.createEdge({
|
|
548
|
+
source: targetCurrency.id,
|
|
549
|
+
target: converter.id,
|
|
550
|
+
input: 'to',
|
|
551
|
+
})
|
|
552
|
+
.createEdge({
|
|
553
|
+
source: converter.id,
|
|
554
|
+
target: view.id,
|
|
555
|
+
output: 'rate',
|
|
556
|
+
});
|
|
506
557
|
});
|
|
507
558
|
|
|
508
559
|
const computeModel = createComputeGraph(canvasModel);
|
|
@@ -530,24 +581,47 @@ export const generator = () => ({
|
|
|
530
581
|
const trigger = canvasModel.createNode(triggerShape);
|
|
531
582
|
// DXOS dev-null channel.
|
|
532
583
|
const channelId = canvasModel.createNode(
|
|
533
|
-
createConstant({
|
|
584
|
+
createConstant({
|
|
585
|
+
value: '1088569858767212554',
|
|
586
|
+
...position({ x: -10, y: 0 }),
|
|
587
|
+
}),
|
|
534
588
|
);
|
|
535
589
|
const queueId = canvasModel.createNode(
|
|
536
590
|
createConstant({
|
|
537
|
-
value:
|
|
591
|
+
value: EchoURI.make({ spaceId: space.id, objectId: Key.ObjectId.random() }),
|
|
538
592
|
...position({ x: -10, y: 5 }),
|
|
539
593
|
}),
|
|
540
594
|
);
|
|
541
595
|
const converter = canvasModel.createNode(createFunction(position({ x: 0, y: 0 })));
|
|
542
596
|
const view = canvasModel.createNode(createText(position({ x: 12, y: 0 })));
|
|
543
|
-
const queue = canvasModel.createNode(
|
|
597
|
+
const queue = canvasModel.createNode(createFeed(position({ x: 0, y: 12 })));
|
|
544
598
|
|
|
545
599
|
builder
|
|
546
|
-
.createEdge({
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
600
|
+
.createEdge({
|
|
601
|
+
source: trigger.id,
|
|
602
|
+
target: converter.id,
|
|
603
|
+
input: 'tick',
|
|
604
|
+
})
|
|
605
|
+
.createEdge({
|
|
606
|
+
source: channelId.id,
|
|
607
|
+
target: converter.id,
|
|
608
|
+
input: 'channelId',
|
|
609
|
+
})
|
|
610
|
+
.createEdge({
|
|
611
|
+
source: queueId.id,
|
|
612
|
+
target: converter.id,
|
|
613
|
+
input: 'queueId',
|
|
614
|
+
})
|
|
615
|
+
.createEdge({
|
|
616
|
+
source: converter.id,
|
|
617
|
+
target: view.id,
|
|
618
|
+
output: 'newMessages',
|
|
619
|
+
})
|
|
620
|
+
.createEdge({
|
|
621
|
+
source: queueId.id,
|
|
622
|
+
target: queue.id,
|
|
623
|
+
input: 'input',
|
|
624
|
+
});
|
|
551
625
|
|
|
552
626
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
553
627
|
});
|
|
@@ -617,7 +691,7 @@ export const generator = () => ({
|
|
|
617
691
|
const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
618
692
|
space: Space,
|
|
619
693
|
triggerKind: SpecType,
|
|
620
|
-
initSpec: (spec: Extract<Trigger.Spec, { kind: SpecType }
|
|
694
|
+
initSpec: (spec: Obj.Mutable<Extract<Trigger.Spec, { kind: SpecType }>>) => void,
|
|
621
695
|
triggerOutputName: string,
|
|
622
696
|
) => {
|
|
623
697
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
@@ -650,7 +724,12 @@ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
|
650
724
|
builder
|
|
651
725
|
.createEdge({ source: queueId.id, target: append.id, input: 'id' })
|
|
652
726
|
.createEdge({ source: template.id, target: append.id, input: 'items' })
|
|
653
|
-
.createEdge({
|
|
727
|
+
.createEdge({
|
|
728
|
+
source: trigger.id,
|
|
729
|
+
target: template.id,
|
|
730
|
+
output: triggerOutputName,
|
|
731
|
+
input: 'type',
|
|
732
|
+
})
|
|
654
733
|
.createEdge({
|
|
655
734
|
source: random.id,
|
|
656
735
|
target: template.id,
|
|
@@ -660,15 +739,20 @@ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
|
660
739
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
661
740
|
const triggerSpec = functionTrigger.spec;
|
|
662
741
|
invariant(triggerSpec && triggerSpec.kind === triggerKind, 'No trigger spec.');
|
|
663
|
-
|
|
742
|
+
Obj.update(functionTrigger, (functionTrigger) => {
|
|
743
|
+
initSpec(functionTrigger.spec as any);
|
|
744
|
+
});
|
|
664
745
|
});
|
|
665
746
|
|
|
666
747
|
const computeModel = createComputeGraph(canvasModel);
|
|
667
748
|
|
|
668
749
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
669
750
|
invariant(templateComputeNode, 'Template compute node was not created.');
|
|
751
|
+
// NOTE: These are plain object mutations during model construction, not ECHO object mutations.
|
|
670
752
|
templateComputeNode.value = ['{', ' "@type": "{{type}}",', ' "id": "@{{changeId}}"', '}'].join('\n');
|
|
671
|
-
templateComputeNode.inputSchema =
|
|
753
|
+
templateComputeNode.inputSchema = JsonSchema.toJsonSchema(
|
|
754
|
+
Schema.Struct({ type: Schema.String, changeId: Schema.String }),
|
|
755
|
+
);
|
|
672
756
|
attachTrigger(functionTrigger, computeModel);
|
|
673
757
|
|
|
674
758
|
return { canvasModel, computeModel };
|
|
@@ -676,7 +760,7 @@ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
|
676
760
|
|
|
677
761
|
const addToSpace = (name: string, space: Space, canvas: CanvasGraphModel, compute: ComputeGraphModel) => {
|
|
678
762
|
return space.db.add(
|
|
679
|
-
Obj.make(
|
|
763
|
+
Obj.make(CanvasBoard.CanvasBoard, {
|
|
680
764
|
name,
|
|
681
765
|
computeGraph: Ref.make(compute.root),
|
|
682
766
|
layout: canvas.graph,
|
|
@@ -691,12 +775,12 @@ const setupQueue = (
|
|
|
691
775
|
) => {
|
|
692
776
|
const queueId = canvasModel.createNode(
|
|
693
777
|
createConstant({
|
|
694
|
-
value:
|
|
778
|
+
value: EchoURI.make({ spaceId: space.id, objectId: Key.ObjectId.random() }),
|
|
695
779
|
...(args?.idPosition ? rawPosition(args.idPosition) : position({ x: -18, y: 5, width: 8, height: 6 })),
|
|
696
780
|
}),
|
|
697
781
|
);
|
|
698
782
|
const queue = canvasModel.createNode(
|
|
699
|
-
|
|
783
|
+
createFeed(
|
|
700
784
|
args?.queuePosition ? rawPosition(args.queuePosition) : position({ x: -3, y: 3, width: 14, height: 10 }),
|
|
701
785
|
),
|
|
702
786
|
);
|
|
@@ -706,15 +790,25 @@ const setupQueue = (
|
|
|
706
790
|
|
|
707
791
|
const attachTrigger = (functionTrigger: Trigger.Trigger | undefined, computeModel: ComputeGraphModel) => {
|
|
708
792
|
invariant(functionTrigger);
|
|
709
|
-
functionTrigger.function = Ref.make(computeModel.root);
|
|
710
793
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
|
|
711
|
-
functionTrigger
|
|
794
|
+
Obj.update(functionTrigger, (functionTrigger) => {
|
|
795
|
+
functionTrigger.function = Ref.make(computeModel.root);
|
|
796
|
+
functionTrigger.inputNodeId = inputNode.id;
|
|
797
|
+
});
|
|
712
798
|
};
|
|
713
799
|
|
|
714
|
-
type RawPositionInput = {
|
|
800
|
+
type RawPositionInput = {
|
|
801
|
+
centerX: number;
|
|
802
|
+
centerY: number;
|
|
803
|
+
width: number;
|
|
804
|
+
height: number;
|
|
805
|
+
};
|
|
715
806
|
|
|
716
807
|
const rawPosition = (args: RawPositionInput) => {
|
|
717
|
-
return {
|
|
808
|
+
return {
|
|
809
|
+
center: { x: args.centerX, y: args.centerY },
|
|
810
|
+
size: { width: args.width, height: args.height },
|
|
811
|
+
};
|
|
718
812
|
};
|
|
719
813
|
|
|
720
814
|
const position = (rect: { x: number; y: number; width?: number; height?: number }) => {
|
|
@@ -722,7 +816,10 @@ const position = (rect: { x: number; y: number; width?: number; height?: number
|
|
|
722
816
|
const [center, size] = rectToPoints({ width: 0, height: 0, ...rect });
|
|
723
817
|
const { x, y, width, height } = pointsToRect([pointMultiply(center, snap), pointMultiply(size, snap)]);
|
|
724
818
|
if (width && height) {
|
|
725
|
-
return {
|
|
819
|
+
return {
|
|
820
|
+
center: { x, y },
|
|
821
|
+
size: width && height ? { width, height } : undefined,
|
|
822
|
+
};
|
|
726
823
|
} else {
|
|
727
824
|
return { center: { x, y } };
|
|
728
825
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { lazy } from 'react';
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
6
|
|
|
7
|
-
export const
|
|
8
|
-
export const DevtoolsOverviewContainer = lazy(() => import('./DevtoolsOverviewContainer'));
|
|
9
|
-
export const SpaceGenerator = lazy(() => import('./SpaceGenerator'));
|
|
7
|
+
export const DebugSettings: ComponentType<any> = lazy(() => import('./DebugSettings'));
|
|
10
8
|
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './DebugStatus';
|
|
14
|
-
export * from './Wireframe';
|
|
9
|
+
export * from './SchemaTable';
|
|
10
|
+
export * from './SpaceGenerator';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { Tree } from '@dxos/devtools';
|
|
8
|
+
import { Graph } from '@dxos/plugin-graph';
|
|
9
|
+
|
|
10
|
+
export type DebugGraphProps = { graph: Graph.Graph; root: string };
|
|
11
|
+
|
|
12
|
+
export const DebugGraph = ({ graph, root }: DebugGraphProps) => {
|
|
13
|
+
return <Tree data={Graph.toJSON(graph, root)} />;
|
|
14
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useMemo, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { ObjectsTree } from '@dxos/devtools';
|
|
9
|
+
import { Filter, Json, Obj, Query } from '@dxos/echo';
|
|
10
|
+
import type { ObjectId } from '@dxos/keys';
|
|
11
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
12
|
+
import { Clipboard, Input, Panel, ScrollArea, Toolbar } from '@dxos/react-ui';
|
|
13
|
+
import { Syntax } from '@dxos/react-ui-syntax-highlighter';
|
|
14
|
+
import { mx } from '@dxos/ui-theme';
|
|
15
|
+
|
|
16
|
+
export type DebugObjectPanelProps = Pick<
|
|
17
|
+
AppSurface.ObjectArticleProps<Obj.Unknown, {}, Obj.Unknown>,
|
|
18
|
+
'role' | 'companionTo'
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
export const DebugObjectPanel = ({ role, companionTo }: DebugObjectPanelProps) => {
|
|
22
|
+
const db = Obj.getDatabase(companionTo);
|
|
23
|
+
const [selectedId, setSelectedId] = useState<ObjectId | null>(null);
|
|
24
|
+
const [depth, setDepth] = useState(0);
|
|
25
|
+
const [selectedObject] = useQuery(
|
|
26
|
+
db,
|
|
27
|
+
Query.select(Filter.id(selectedId ?? companionTo.id)).options({ deleted: 'include' }),
|
|
28
|
+
);
|
|
29
|
+
const refReplacer = useMemo(() => (db ? Json.createRefReplacer({ db, depth }) : undefined), [db, depth]);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Clipboard.Provider>
|
|
33
|
+
<Panel.Root role={role}>
|
|
34
|
+
<Panel.Toolbar asChild>
|
|
35
|
+
<Toolbar.Root />
|
|
36
|
+
</Panel.Toolbar>
|
|
37
|
+
<Panel.Content asChild>
|
|
38
|
+
<div className={mx('grid divide-y divide-separator', db && 'grid-rows-[1fr_2fr]')}>
|
|
39
|
+
{db && (
|
|
40
|
+
<ScrollArea.Root>
|
|
41
|
+
<ScrollArea.Viewport>
|
|
42
|
+
<ObjectsTree db={db} root={companionTo} onSelect={(entity) => setSelectedId(entity.id)} />
|
|
43
|
+
</ScrollArea.Viewport>
|
|
44
|
+
</ScrollArea.Root>
|
|
45
|
+
)}
|
|
46
|
+
<Syntax.Root data={selectedObject} replacer={refReplacer}>
|
|
47
|
+
<Panel.Root>
|
|
48
|
+
<Panel.Toolbar asChild>
|
|
49
|
+
<Toolbar.Root classNames='grid grid-cols-[1fr_3rem]'>
|
|
50
|
+
<Syntax.Filter />
|
|
51
|
+
<Input.Root>
|
|
52
|
+
<Input.TextInput
|
|
53
|
+
variant='subdued'
|
|
54
|
+
type='number'
|
|
55
|
+
min={0}
|
|
56
|
+
step={1}
|
|
57
|
+
aria-label='Ref depth'
|
|
58
|
+
value={depth}
|
|
59
|
+
onChange={(event) => setDepth(Math.max(0, Number(event.target.value) || 0))}
|
|
60
|
+
/>
|
|
61
|
+
</Input.Root>
|
|
62
|
+
</Toolbar.Root>
|
|
63
|
+
</Panel.Toolbar>
|
|
64
|
+
<Panel.Content asChild>
|
|
65
|
+
<Syntax.Viewport>
|
|
66
|
+
<Syntax.Code />
|
|
67
|
+
</Syntax.Viewport>
|
|
68
|
+
</Panel.Content>
|
|
69
|
+
</Panel.Root>
|
|
70
|
+
</Syntax.Root>
|
|
71
|
+
</div>
|
|
72
|
+
</Panel.Content>
|
|
73
|
+
</Panel.Root>
|
|
74
|
+
</Clipboard.Provider>
|
|
75
|
+
);
|
|
76
|
+
};
|