@dxos/plugin-debug 0.8.4-main.c1de068 → 0.8.4-main.c85a9c8dae
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/DebugGraph-7HXJ2PS2.mjs +16 -0
- package/dist/lib/browser/DebugGraph-7HXJ2PS2.mjs.map +7 -0
- package/dist/lib/browser/DebugObjectPanel-3TCDNUNW.mjs +33 -0
- package/dist/lib/browser/DebugObjectPanel-3TCDNUNW.mjs.map +7 -0
- package/dist/lib/browser/DebugSettings-JZMIUDYB.mjs +174 -0
- package/dist/lib/browser/DebugSettings-JZMIUDYB.mjs.map +7 -0
- package/dist/lib/browser/DebugSpaceObjectsPanel-7NRPLWZ4.mjs +50 -0
- package/dist/lib/browser/DebugSpaceObjectsPanel-7NRPLWZ4.mjs.map +7 -0
- package/dist/lib/browser/DebugStatus-COQGH37G.mjs +125 -0
- package/dist/lib/browser/DebugStatus-COQGH37G.mjs.map +7 -0
- package/dist/lib/browser/DevtoolsOverviewContainer-C75NFVER.mjs +20 -0
- package/dist/lib/browser/DevtoolsOverviewContainer-C75NFVER.mjs.map +7 -0
- package/dist/lib/browser/{SpaceGenerator-AG3XGNMV.mjs → SpaceGenerator-SWSGJEEL.mjs} +573 -382
- package/dist/lib/browser/SpaceGenerator-SWSGJEEL.mjs.map +7 -0
- package/dist/lib/browser/Wireframe-KAGOKEFW.mjs +53 -0
- package/dist/lib/browser/Wireframe-KAGOKEFW.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-LGUQNXHD.mjs +625 -0
- package/dist/lib/browser/app-graph-builder-LGUQNXHD.mjs.map +7 -0
- package/dist/lib/browser/{chunk-AJA6RYN3.mjs → chunk-4UFQXPP7.mjs} +12 -2
- package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +7 -0
- package/dist/lib/browser/chunk-A5H5GRV6.mjs +20 -0
- package/dist/lib/browser/chunk-A5H5GRV6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +43 -41
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-I3USIAF6.mjs +17 -0
- package/dist/lib/browser/react-context-I3USIAF6.mjs.map +7 -0
- package/dist/lib/browser/react-surface-BTVNKKVQ.mjs +443 -0
- package/dist/lib/browser/react-surface-BTVNKKVQ.mjs.map +7 -0
- package/dist/lib/browser/settings-SLTQJJNF.mjs +32 -0
- package/dist/lib/browser/settings-SLTQJJNF.mjs.map +7 -0
- package/dist/types/src/DebugPlugin.d.ts +7 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -8
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context/index.d.ts +7 -0
- package/dist/types/src/capabilities/react-context/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-context/react-context.d.ts +10 -0
- package/dist/types/src/capabilities/react-context/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +9 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +3 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +6 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/components/SchemaTable/SchemaTable.d.ts.map +1 -0
- package/dist/types/src/components/SchemaTable/index.d.ts +2 -0
- package/dist/types/src/components/SchemaTable/index.d.ts.map +1 -0
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +5 -5
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/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 +4 -4
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -9
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts +8 -0
- package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts.map +1 -0
- package/dist/types/src/containers/DebugGraph/index.d.ts +3 -0
- package/dist/types/src/containers/DebugGraph/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/DebugObjectPanel}/DebugObjectPanel.d.ts +2 -2
- package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -0
- package/dist/types/src/containers/DebugObjectPanel/index.d.ts +3 -0
- package/dist/types/src/containers/DebugObjectPanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts +10 -0
- package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts.map +1 -0
- package/dist/types/src/containers/DebugSettings/index.d.ts +3 -0
- package/dist/types/src/containers/DebugSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +3 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts +3 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts.map +1 -0
- package/dist/types/src/containers/DebugStatus/index.d.ts +3 -0
- package/dist/types/src/containers/DebugStatus/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/DevtoolsOverviewContainer}/DevtoolsOverviewContainer.d.ts +0 -1
- package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts.map +1 -0
- package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts +3 -0
- package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/SpaceGenerator/SpaceGenerator.d.ts +2 -2
- package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts.map +1 -0
- package/dist/types/src/containers/SpaceGenerator/index.d.ts +3 -0
- package/dist/types/src/containers/SpaceGenerator/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/Wireframe}/Wireframe.d.ts +2 -2
- package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -0
- package/dist/types/src/containers/Wireframe/index.d.ts +3 -0
- package/dist/types/src/containers/Wireframe/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +10 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +5 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +6 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +76 -67
- package/src/DebugPlugin.tsx +27 -32
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +441 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/index.ts +4 -6
- package/src/capabilities/react-context/index.ts +7 -0
- package/src/capabilities/react-context/react-context.tsx +20 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +428 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +31 -0
- package/src/components/SchemaTable/index.ts +5 -0
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +32 -38
- package/src/components/SpaceGenerator/draw-util.ts +5 -5
- package/src/components/SpaceGenerator/index.ts +2 -3
- package/src/components/SpaceGenerator/presets.ts +337 -53
- package/src/components/index.ts +2 -10
- package/src/containers/DebugGraph/DebugGraph.tsx +13 -0
- package/src/containers/DebugGraph/index.ts +7 -0
- package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +45 -0
- package/src/containers/DebugObjectPanel/index.ts +7 -0
- package/src/containers/DebugSettings/DebugSettings.tsx +201 -0
- package/src/containers/DebugSettings/index.ts +7 -0
- package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +60 -0
- package/src/containers/DebugSpaceObjectsPanel/index.ts +7 -0
- package/src/{components → containers/DebugStatus}/DebugStatus.tsx +2 -2
- package/src/containers/DebugStatus/index.ts +7 -0
- package/src/{components → containers/DevtoolsOverviewContainer}/DevtoolsOverviewContainer.tsx +2 -4
- package/src/containers/DevtoolsOverviewContainer/index.ts +7 -0
- package/src/containers/SpaceGenerator/SpaceGenerator.tsx +127 -0
- package/src/containers/SpaceGenerator/index.ts +7 -0
- package/src/{components → containers/Wireframe}/Wireframe.tsx +7 -7
- package/src/containers/Wireframe/index.ts +7 -0
- package/src/containers/index.ts +14 -0
- package/src/meta.ts +8 -7
- package/src/translations.ts +5 -1
- package/src/types.ts +9 -1
- package/dist/lib/browser/DebugApp-ZDL4CPY5.mjs +0 -228
- package/dist/lib/browser/DebugApp-ZDL4CPY5.mjs.map +0 -7
- package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs +0 -25
- package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-AG3XGNMV.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-SQXFD2BL.mjs +0 -597
- package/dist/lib/browser/app-graph-builder-SQXFD2BL.mjs.map +0 -7
- package/dist/lib/browser/chunk-5XPIRNQS.mjs +0 -18
- package/dist/lib/browser/chunk-5XPIRNQS.mjs.map +0 -7
- package/dist/lib/browser/chunk-AJA6RYN3.mjs.map +0 -7
- package/dist/lib/browser/react-context-NVAGLAJD.mjs +0 -16
- package/dist/lib/browser/react-context-NVAGLAJD.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3GD2OWCA.mjs +0 -768
- package/dist/lib/browser/react-surface-3GD2OWCA.mjs.map +0 -7
- package/dist/lib/browser/settings-LSSWLM5I.mjs +0 -22
- package/dist/lib/browser/settings-LSSWLM5I.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-context.d.ts +0 -8
- package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/components/Container.d.ts +0 -5
- package/dist/types/src/components/Container.d.ts.map +0 -1
- package/dist/types/src/components/DebugApp/DebugApp.d.ts +0 -6
- package/dist/types/src/components/DebugApp/DebugApp.d.ts.map +0 -1
- package/dist/types/src/components/DebugApp/Tree.d.ts +0 -18
- package/dist/types/src/components/DebugApp/Tree.d.ts.map +0 -1
- package/dist/types/src/components/DebugApp/index.d.ts +0 -3
- package/dist/types/src/components/DebugApp/index.d.ts.map +0 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +0 -1
- package/dist/types/src/components/DebugSettings.d.ts +0 -6
- package/dist/types/src/components/DebugSettings.d.ts.map +0 -1
- package/dist/types/src/components/DebugStatus.d.ts.map +0 -1
- package/dist/types/src/components/DevtoolsOverviewContainer.d.ts.map +0 -1
- package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +0 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +0 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +0 -6
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +0 -1
- package/dist/types/src/components/Wireframe.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -457
- package/src/capabilities/react-context.tsx +0 -16
- package/src/capabilities/react-surface.tsx +0 -397
- package/src/capabilities/settings.ts +0 -19
- package/src/components/Container.tsx +0 -15
- package/src/components/DebugApp/DebugApp.tsx +0 -84
- package/src/components/DebugApp/Tree.tsx +0 -103
- package/src/components/DebugApp/index.ts +0 -7
- package/src/components/DebugObjectPanel.tsx +0 -35
- package/src/components/DebugSettings.tsx +0 -151
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +0 -52
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +0 -122
- /package/dist/types/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.d.ts +0 -0
- /package/dist/types/src/{components → containers/DebugStatus}/DebugStatus.d.ts +0 -0
- /package/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.tsx +0 -0
|
@@ -2,12 +2,17 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
+
import { AgentFunctions, EntityExtractionFunctions, ResearchBlueprint } from '@dxos/assistant-toolkit';
|
|
8
|
+
import { Prompt } from '@dxos/blueprints';
|
|
7
9
|
import { type ComputeGraphModel, NODE_INPUT } from '@dxos/conductor';
|
|
8
|
-
import { DXN, Key, Obj, Ref,
|
|
9
|
-
import {
|
|
10
|
+
import { DXN, Feed, Filter, JsonSchema, Key, Obj, Query, type QueryAST, Ref, Tag } from '@dxos/echo';
|
|
11
|
+
import { Trigger, serializeFunction } from '@dxos/functions';
|
|
10
12
|
import { invariant } from '@dxos/invariant';
|
|
13
|
+
import { GmailFunctions } from '@dxos/plugin-inbox';
|
|
14
|
+
import { Mailbox } from '@dxos/plugin-inbox/types';
|
|
15
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
11
16
|
import { type Space } from '@dxos/react-client/echo';
|
|
12
17
|
import {
|
|
13
18
|
type ComputeShape,
|
|
@@ -18,51 +23,246 @@ import {
|
|
|
18
23
|
createFunction,
|
|
19
24
|
createGpt,
|
|
20
25
|
createQueue,
|
|
21
|
-
createSurface,
|
|
22
26
|
createRandom,
|
|
27
|
+
createSurface,
|
|
23
28
|
createTemplate,
|
|
24
29
|
createText,
|
|
25
30
|
createTrigger,
|
|
26
31
|
} from '@dxos/react-ui-canvas-compute';
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
pointsToRect,
|
|
32
|
-
rectToPoints,
|
|
33
|
-
} from '@dxos/react-ui-canvas-editor';
|
|
34
|
-
import { range } from '@dxos/util';
|
|
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';
|
|
35
|
+
import { range, trim } from '@dxos/util';
|
|
35
36
|
|
|
36
37
|
import { type ObjectGenerator } from './ObjectGenerator';
|
|
37
38
|
|
|
38
39
|
export enum PresetName {
|
|
40
|
+
DXOS_TEAM = 'dxos-team',
|
|
41
|
+
ORG_RESEARCH_PROJECT = 'org-research-project',
|
|
39
42
|
// EMAIL_TABLE = 'email-table',
|
|
40
43
|
GPT_QUEUE = 'webhook-gpt-queue',
|
|
41
44
|
CHAT_GPT = 'chat-gpt-text',
|
|
42
45
|
// EMAIL_WITH_SUMMARY = 'email-gptSummary-table',
|
|
43
46
|
OBJECT_CHANGE_QUEUE = 'objectChange-queue',
|
|
44
|
-
FOREX_FUNCTION_CALL = 'forex-function-call',
|
|
45
47
|
TIMER_TICK_QUEUE = 'timerTick-queue',
|
|
48
|
+
FOREX_FUNCTION_CALL = 'forex-function-call',
|
|
46
49
|
DISCORD_MESSAGES = 'discord-messages',
|
|
47
50
|
// KANBAN_QUEUE = 'kanban-queue',
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
export const generator = () => ({
|
|
51
|
-
schemas: [
|
|
54
|
+
schemas: [CanvasBoard.CanvasBoard, Trigger.Trigger] as any[],
|
|
52
55
|
types: Object.values(PresetName).map((name) => ({ typename: name })),
|
|
53
56
|
items: [
|
|
57
|
+
[
|
|
58
|
+
PresetName.DXOS_TEAM,
|
|
59
|
+
async (space, n, cb) => {
|
|
60
|
+
const objects = range(n, () => {
|
|
61
|
+
const org = space.db.add(
|
|
62
|
+
Obj.make(Organization.Organization, {
|
|
63
|
+
name: 'DXOS',
|
|
64
|
+
website: 'https://dxos.org',
|
|
65
|
+
}),
|
|
66
|
+
);
|
|
67
|
+
const doc = space.db.add(
|
|
68
|
+
Markdown.make({
|
|
69
|
+
name: 'DXOS Research',
|
|
70
|
+
content: 'DXOS builds Composer, an open-source AI-powered malleable application.',
|
|
71
|
+
}),
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const tag = space.db.add(Tag.make({ label: 'Investor' }));
|
|
75
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
76
|
+
Obj.change(doc, (d) => {
|
|
77
|
+
Obj.getMeta(d).tags = [tagDxn];
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// space.db.add(
|
|
81
|
+
// Relation.make(HasSubject, {
|
|
82
|
+
// [Relation.Source]: doc,
|
|
83
|
+
// [Relation.Target]: org,
|
|
84
|
+
// completedAt: new Date().toISOString(),
|
|
85
|
+
// }),
|
|
86
|
+
// );
|
|
87
|
+
|
|
88
|
+
space.db.add(
|
|
89
|
+
Obj.make(Person.Person, { [Obj.Meta]: { tags: [tagDxn] }, 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
|
+
);
|
|
109
|
+
|
|
110
|
+
return doc;
|
|
111
|
+
});
|
|
112
|
+
cb?.(objects);
|
|
113
|
+
return objects;
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
[
|
|
117
|
+
PresetName.ORG_RESEARCH_PROJECT,
|
|
118
|
+
async (space, n, cb) => {
|
|
119
|
+
const feeds = await space.db.query(Filter.type(Feed.Feed)).run();
|
|
120
|
+
const mailbox = feeds.find((feed) => feed.kind === Mailbox.kind);
|
|
121
|
+
invariant(mailbox, 'Mailbox feed not found');
|
|
122
|
+
const queueDxn = Feed.getQueueDxn(mailbox)?.toString();
|
|
123
|
+
invariant(queueDxn, 'Mailbox feed missing queue DXN key');
|
|
124
|
+
const tag = await space.db.query(Filter.type(Tag.Tag, { label: 'Investor' })).first();
|
|
125
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
126
|
+
|
|
127
|
+
const objects = range(n, () => {
|
|
128
|
+
const contactsQuery = Query.select(Filter.type(Person.Person)).select(Filter.tag(tagDxn));
|
|
129
|
+
const organizationsQuery = Query.select(Filter.type(Organization.Organization)).select(Filter.tag(tagDxn));
|
|
130
|
+
const notesQuery = Query.select(Filter.type(Markdown.Document)).select(Filter.tag(tagDxn));
|
|
131
|
+
|
|
132
|
+
space.db.add(
|
|
133
|
+
Trigger.make({
|
|
134
|
+
enabled: true,
|
|
135
|
+
spec: {
|
|
136
|
+
kind: 'timer',
|
|
137
|
+
cron: '* * * * *', // Every minute.
|
|
138
|
+
},
|
|
139
|
+
function: Ref.make(serializeFunction(GmailFunctions.Sync)),
|
|
140
|
+
input: {
|
|
141
|
+
mailbox: Ref.make(mailbox),
|
|
142
|
+
},
|
|
143
|
+
}),
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
space.db.add(
|
|
147
|
+
Trigger.make({
|
|
148
|
+
enabled: true,
|
|
149
|
+
// TODO(wittjosiah): Queue trigger doesn't support matching query of the column.
|
|
150
|
+
spec: {
|
|
151
|
+
kind: 'queue',
|
|
152
|
+
queue: queueDxn,
|
|
153
|
+
},
|
|
154
|
+
function: Ref.make(serializeFunction(EntityExtractionFunctions.Extract)),
|
|
155
|
+
input: {
|
|
156
|
+
source: '{{event.item}}',
|
|
157
|
+
},
|
|
158
|
+
}),
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
const researchPrompt = space.db.add(
|
|
162
|
+
Prompt.make({
|
|
163
|
+
name: 'Research',
|
|
164
|
+
description: 'Research organization',
|
|
165
|
+
input: Schema.Struct({
|
|
166
|
+
org: Schema.Any,
|
|
167
|
+
}),
|
|
168
|
+
output: Schema.Any,
|
|
169
|
+
|
|
170
|
+
// TODO(dmaretskyi): This mocks research (returns pre-baked result), the actual research might take compute minutes.
|
|
171
|
+
// Remove the mock prompt to do the actual research.
|
|
172
|
+
instructions: trim`
|
|
173
|
+
Research the organization provided as input.
|
|
174
|
+
Create a research note for it at the end.
|
|
175
|
+
NOTE: Do mocked reseach (set mockSearch to true).
|
|
176
|
+
`,
|
|
177
|
+
blueprints: [Ref.make(ResearchBlueprint.make())],
|
|
178
|
+
}),
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
space.db.add(
|
|
182
|
+
Trigger.make({
|
|
183
|
+
enabled: true,
|
|
184
|
+
spec: {
|
|
185
|
+
kind: 'subscription',
|
|
186
|
+
query: {
|
|
187
|
+
ast: organizationsQuery.ast,
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
function: Ref.make(serializeFunction(AgentFunctions.Prompt)),
|
|
191
|
+
input: {
|
|
192
|
+
prompt: Ref.make(researchPrompt),
|
|
193
|
+
input: '{{event.subject}}',
|
|
194
|
+
},
|
|
195
|
+
}),
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
const mailboxView = ViewModel.make({
|
|
199
|
+
query: Query.select(
|
|
200
|
+
Filter.type(Message.Message, {
|
|
201
|
+
properties: { labels: Filter.contains('investor') },
|
|
202
|
+
}),
|
|
203
|
+
).from({
|
|
204
|
+
queues: [queueDxn],
|
|
205
|
+
}),
|
|
206
|
+
jsonSchema: JsonSchema.toJsonSchema(Message.Message),
|
|
207
|
+
});
|
|
208
|
+
const contactsView = ViewModel.make({
|
|
209
|
+
query: contactsQuery,
|
|
210
|
+
jsonSchema: JsonSchema.toJsonSchema(Person.Person),
|
|
211
|
+
});
|
|
212
|
+
const organizationsView = ViewModel.make({
|
|
213
|
+
query: organizationsQuery,
|
|
214
|
+
jsonSchema: JsonSchema.toJsonSchema(Organization.Organization),
|
|
215
|
+
});
|
|
216
|
+
const notesView = ViewModel.make({
|
|
217
|
+
query: notesQuery,
|
|
218
|
+
jsonSchema: JsonSchema.toJsonSchema(Markdown.Document),
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
return space.db.add(
|
|
222
|
+
Pipeline.make({
|
|
223
|
+
name: 'Investor Research',
|
|
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
|
+
],
|
|
246
|
+
}),
|
|
247
|
+
);
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
cb?.(objects.flat());
|
|
251
|
+
return objects.flat();
|
|
252
|
+
},
|
|
253
|
+
],
|
|
54
254
|
[
|
|
55
255
|
PresetName.GPT_QUEUE,
|
|
56
256
|
async (space, n, cb) => {
|
|
57
257
|
const objects = range(n, () => {
|
|
58
258
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
59
259
|
|
|
60
|
-
let functionTrigger:
|
|
260
|
+
let functionTrigger: Trigger.Trigger | undefined;
|
|
61
261
|
canvasModel.builder.call((builder) => {
|
|
62
262
|
const gpt = canvasModel.createNode(createGpt(position({ x: 0, y: -14 })));
|
|
63
263
|
const triggerShape = createTrigger({
|
|
64
264
|
spaceId: space.id,
|
|
65
|
-
triggerKind:
|
|
265
|
+
triggerKind: 'webhook',
|
|
66
266
|
...position({ x: -18, y: -2 }),
|
|
67
267
|
});
|
|
68
268
|
const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -71,10 +271,24 @@ export const generator = () => ({
|
|
|
71
271
|
const append = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
|
|
72
272
|
|
|
73
273
|
builder
|
|
74
|
-
.createEdge({
|
|
274
|
+
.createEdge({
|
|
275
|
+
source: trigger.id,
|
|
276
|
+
target: gpt.id,
|
|
277
|
+
input: 'prompt',
|
|
278
|
+
output: 'bodyText',
|
|
279
|
+
})
|
|
75
280
|
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
76
|
-
.createEdge({
|
|
77
|
-
|
|
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
|
+
});
|
|
78
292
|
|
|
79
293
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
80
294
|
});
|
|
@@ -96,8 +310,11 @@ export const generator = () => ({
|
|
|
96
310
|
const objects = range(n, () => {
|
|
97
311
|
const { canvasModel, computeModel } = createQueueSinkPreset(
|
|
98
312
|
space,
|
|
99
|
-
|
|
100
|
-
(triggerSpec) =>
|
|
313
|
+
'subscription',
|
|
314
|
+
(triggerSpec) =>
|
|
315
|
+
(triggerSpec.query = {
|
|
316
|
+
ast: Query.select(Filter.typename('dxos.org/type/Chess')).ast as Obj.Mutable<QueryAST.Query>,
|
|
317
|
+
}),
|
|
101
318
|
'type',
|
|
102
319
|
);
|
|
103
320
|
return addToSpace(PresetName.OBJECT_CHANGE_QUEUE, space, canvasModel, computeModel);
|
|
@@ -113,7 +330,7 @@ export const generator = () => ({
|
|
|
113
330
|
const objects = range(n, () => {
|
|
114
331
|
const { canvasModel, computeModel } = createQueueSinkPreset(
|
|
115
332
|
space,
|
|
116
|
-
|
|
333
|
+
'timer',
|
|
117
334
|
(triggerSpec) => (triggerSpec.cron = '*/5 * * * * *'),
|
|
118
335
|
'result',
|
|
119
336
|
);
|
|
@@ -147,7 +364,7 @@ export const generator = () => ({
|
|
|
147
364
|
// canvasModel.builder.call((builder) => {
|
|
148
365
|
// const triggerShape = createTrigger({
|
|
149
366
|
// spaceId: space.id,
|
|
150
|
-
// triggerKind:
|
|
367
|
+
// triggerKind: 'email',
|
|
151
368
|
// ...position({ x: -18, y: -2 }),
|
|
152
369
|
// });
|
|
153
370
|
// const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -181,7 +398,7 @@ export const generator = () => ({
|
|
|
181
398
|
// const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
182
399
|
// invariant(templateComputeNode, 'Template compute node was not created.');
|
|
183
400
|
// templateComputeNode.value = templateContent.join('\n');
|
|
184
|
-
// templateComputeNode.inputSchema =
|
|
401
|
+
// templateComputeNode.inputSchema = JsonSchema.toJsonSchema(EmailTriggerOutput);
|
|
185
402
|
|
|
186
403
|
// attachTrigger(functionTrigger, computeModel);
|
|
187
404
|
|
|
@@ -209,8 +426,17 @@ export const generator = () => ({
|
|
|
209
426
|
builder
|
|
210
427
|
.createEdge({ source: chat.id, target: gpt.id, input: 'prompt' })
|
|
211
428
|
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
212
|
-
.createEdge({
|
|
213
|
-
|
|
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
|
+
});
|
|
214
440
|
});
|
|
215
441
|
|
|
216
442
|
const computeModel = createComputeGraph(canvasModel);
|
|
@@ -254,7 +480,7 @@ export const generator = () => ({
|
|
|
254
480
|
// );
|
|
255
481
|
// const triggerShape = createTrigger({
|
|
256
482
|
// spaceId: space.id,
|
|
257
|
-
// triggerKind:
|
|
483
|
+
// triggerKind: 'email',
|
|
258
484
|
// ...rawPosition({ centerX: -736, centerY: -384, width: 182, height: 192 }),
|
|
259
485
|
// });
|
|
260
486
|
// const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -306,7 +532,7 @@ export const generator = () => ({
|
|
|
306
532
|
// invariant(templateComputeNode, 'Template compute node was not created.');
|
|
307
533
|
// templateComputeNode.value = templateContent.join('\n');
|
|
308
534
|
// const extendedSchema = Schema.extend(EmailTriggerOutput, Schema.Struct({ text: Schema.String }));
|
|
309
|
-
// templateComputeNode.inputSchema =
|
|
535
|
+
// templateComputeNode.inputSchema = JsonSchema.toJsonSchema(extendedSchema);
|
|
310
536
|
|
|
311
537
|
// attachTrigger(functionTrigger, computeModel);
|
|
312
538
|
|
|
@@ -334,9 +560,21 @@ export const generator = () => ({
|
|
|
334
560
|
const view = canvasModel.createNode(createSurface(position({ x: 12, y: 0 })));
|
|
335
561
|
|
|
336
562
|
builder
|
|
337
|
-
.createEdge({
|
|
338
|
-
|
|
339
|
-
|
|
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
|
+
});
|
|
340
578
|
});
|
|
341
579
|
|
|
342
580
|
const computeModel = createComputeGraph(canvasModel);
|
|
@@ -354,17 +592,20 @@ export const generator = () => ({
|
|
|
354
592
|
const objects = range(n, () => {
|
|
355
593
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
356
594
|
|
|
357
|
-
let functionTrigger:
|
|
595
|
+
let functionTrigger: Trigger.Trigger | undefined;
|
|
358
596
|
canvasModel.builder.call((builder) => {
|
|
359
597
|
const triggerShape = createTrigger({
|
|
360
598
|
spaceId: space.id,
|
|
361
|
-
triggerKind:
|
|
599
|
+
triggerKind: 'timer',
|
|
362
600
|
...position({ x: -10, y: -5 }),
|
|
363
601
|
});
|
|
364
602
|
const trigger = canvasModel.createNode(triggerShape);
|
|
365
603
|
// DXOS dev-null channel.
|
|
366
604
|
const channelId = canvasModel.createNode(
|
|
367
|
-
createConstant({
|
|
605
|
+
createConstant({
|
|
606
|
+
value: '1088569858767212554',
|
|
607
|
+
...position({ x: -10, y: 0 }),
|
|
608
|
+
}),
|
|
368
609
|
);
|
|
369
610
|
const queueId = canvasModel.createNode(
|
|
370
611
|
createConstant({
|
|
@@ -377,11 +618,31 @@ export const generator = () => ({
|
|
|
377
618
|
const queue = canvasModel.createNode(createQueue(position({ x: 0, y: 12 })));
|
|
378
619
|
|
|
379
620
|
builder
|
|
380
|
-
.createEdge({
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
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
|
+
});
|
|
385
646
|
|
|
386
647
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
387
648
|
});
|
|
@@ -416,7 +677,7 @@ export const generator = () => ({
|
|
|
416
677
|
// canvasModel.builder.call((builder) => {
|
|
417
678
|
// const triggerShape = createTrigger({
|
|
418
679
|
// spaceId: space.id,
|
|
419
|
-
// triggerKind:
|
|
680
|
+
// triggerKind: 'queue',
|
|
420
681
|
// ...position({ x: -10, y: -5 }),
|
|
421
682
|
// });
|
|
422
683
|
// const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -448,10 +709,10 @@ export const generator = () => ({
|
|
|
448
709
|
] as [PresetName, ObjectGenerator<any>][],
|
|
449
710
|
});
|
|
450
711
|
|
|
451
|
-
const createQueueSinkPreset = <SpecType extends
|
|
712
|
+
const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
452
713
|
space: Space,
|
|
453
714
|
triggerKind: SpecType,
|
|
454
|
-
initSpec: (spec: Extract<
|
|
715
|
+
initSpec: (spec: Obj.Mutable<Extract<Trigger.Spec, { kind: SpecType }>>) => void,
|
|
455
716
|
triggerOutputName: string,
|
|
456
717
|
) => {
|
|
457
718
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
@@ -463,7 +724,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
463
724
|
}),
|
|
464
725
|
);
|
|
465
726
|
|
|
466
|
-
let functionTrigger:
|
|
727
|
+
let functionTrigger: Trigger.Trigger | undefined;
|
|
467
728
|
canvasModel.builder.call((builder) => {
|
|
468
729
|
const triggerShape = createTrigger({
|
|
469
730
|
spaceId: space.id,
|
|
@@ -484,7 +745,12 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
484
745
|
builder
|
|
485
746
|
.createEdge({ source: queueId.id, target: append.id, input: 'id' })
|
|
486
747
|
.createEdge({ source: template.id, target: append.id, input: 'items' })
|
|
487
|
-
.createEdge({
|
|
748
|
+
.createEdge({
|
|
749
|
+
source: trigger.id,
|
|
750
|
+
target: template.id,
|
|
751
|
+
output: triggerOutputName,
|
|
752
|
+
input: 'type',
|
|
753
|
+
})
|
|
488
754
|
.createEdge({
|
|
489
755
|
source: random.id,
|
|
490
756
|
target: template.id,
|
|
@@ -494,15 +760,20 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
494
760
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
495
761
|
const triggerSpec = functionTrigger.spec;
|
|
496
762
|
invariant(triggerSpec && triggerSpec.kind === triggerKind, 'No trigger spec.');
|
|
497
|
-
|
|
763
|
+
Obj.change(functionTrigger, (ft) => {
|
|
764
|
+
initSpec(ft.spec as any);
|
|
765
|
+
});
|
|
498
766
|
});
|
|
499
767
|
|
|
500
768
|
const computeModel = createComputeGraph(canvasModel);
|
|
501
769
|
|
|
502
770
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
503
771
|
invariant(templateComputeNode, 'Template compute node was not created.');
|
|
772
|
+
// NOTE: These are plain object mutations during model construction, not ECHO object mutations.
|
|
504
773
|
templateComputeNode.value = ['{', ' "@type": "{{type}}",', ' "id": "@{{changeId}}"', '}'].join('\n');
|
|
505
|
-
templateComputeNode.inputSchema =
|
|
774
|
+
templateComputeNode.inputSchema = JsonSchema.toJsonSchema(
|
|
775
|
+
Schema.Struct({ type: Schema.String, changeId: Schema.String }),
|
|
776
|
+
);
|
|
506
777
|
attachTrigger(functionTrigger, computeModel);
|
|
507
778
|
|
|
508
779
|
return { canvasModel, computeModel };
|
|
@@ -510,7 +781,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
510
781
|
|
|
511
782
|
const addToSpace = (name: string, space: Space, canvas: CanvasGraphModel, compute: ComputeGraphModel) => {
|
|
512
783
|
return space.db.add(
|
|
513
|
-
Obj.make(
|
|
784
|
+
Obj.make(CanvasBoard.CanvasBoard, {
|
|
514
785
|
name,
|
|
515
786
|
computeGraph: Ref.make(compute.root),
|
|
516
787
|
layout: canvas.graph,
|
|
@@ -538,17 +809,27 @@ const setupQueue = (
|
|
|
538
809
|
return { queue, queueId };
|
|
539
810
|
};
|
|
540
811
|
|
|
541
|
-
const attachTrigger = (functionTrigger:
|
|
812
|
+
const attachTrigger = (functionTrigger: Trigger.Trigger | undefined, computeModel: ComputeGraphModel) => {
|
|
542
813
|
invariant(functionTrigger);
|
|
543
|
-
functionTrigger.function = Ref.make(computeModel.root);
|
|
544
814
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
|
|
545
|
-
functionTrigger
|
|
815
|
+
Obj.change(functionTrigger, (t) => {
|
|
816
|
+
t.function = Ref.make(computeModel.root);
|
|
817
|
+
t.inputNodeId = inputNode.id;
|
|
818
|
+
});
|
|
546
819
|
};
|
|
547
820
|
|
|
548
|
-
type RawPositionInput = {
|
|
821
|
+
type RawPositionInput = {
|
|
822
|
+
centerX: number;
|
|
823
|
+
centerY: number;
|
|
824
|
+
width: number;
|
|
825
|
+
height: number;
|
|
826
|
+
};
|
|
549
827
|
|
|
550
828
|
const rawPosition = (args: RawPositionInput) => {
|
|
551
|
-
return {
|
|
829
|
+
return {
|
|
830
|
+
center: { x: args.centerX, y: args.centerY },
|
|
831
|
+
size: { width: args.width, height: args.height },
|
|
832
|
+
};
|
|
552
833
|
};
|
|
553
834
|
|
|
554
835
|
const position = (rect: { x: number; y: number; width?: number; height?: number }) => {
|
|
@@ -556,7 +837,10 @@ const position = (rect: { x: number; y: number; width?: number; height?: number
|
|
|
556
837
|
const [center, size] = rectToPoints({ width: 0, height: 0, ...rect });
|
|
557
838
|
const { x, y, width, height } = pointsToRect([pointMultiply(center, snap), pointMultiply(size, snap)]);
|
|
558
839
|
if (width && height) {
|
|
559
|
-
return {
|
|
840
|
+
return {
|
|
841
|
+
center: { x, y },
|
|
842
|
+
size: width && height ? { width, height } : undefined,
|
|
843
|
+
};
|
|
560
844
|
} else {
|
|
561
845
|
return { center: { x, y } };
|
|
562
846
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -2,13 +2,5 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const DebugApp = lazy(() => import('./DebugApp'));
|
|
8
|
-
export const DevtoolsOverviewContainer = lazy(() => import('./DevtoolsOverviewContainer'));
|
|
9
|
-
export const SpaceGenerator = lazy(() => import('./SpaceGenerator'));
|
|
10
|
-
|
|
11
|
-
export * from './DebugObjectPanel';
|
|
12
|
-
export * from './DebugSettings';
|
|
13
|
-
export * from './DebugStatus';
|
|
14
|
-
export * from './Wireframe';
|
|
5
|
+
export * from './SchemaTable';
|
|
6
|
+
export * from './SpaceGenerator';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type FC } 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
|
+
export const DebugGraph: FC<DebugGraphProps> = ({ graph, root }) => {
|
|
12
|
+
return <Tree data={Graph.toJSON(graph, root)} />;
|
|
13
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { ObjectsTree } from '@dxos/devtools';
|
|
8
|
+
import { Filter, Obj, Query } from '@dxos/echo';
|
|
9
|
+
import type { ObjectId } from '@dxos/keys';
|
|
10
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
11
|
+
import { Clipboard, Grid, Panel, ScrollArea } from '@dxos/react-ui';
|
|
12
|
+
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
13
|
+
|
|
14
|
+
export type DebugObjectPanelProps = {
|
|
15
|
+
object: Obj.Unknown;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const DebugObjectPanel = ({ object }: DebugObjectPanelProps) => {
|
|
19
|
+
const db = Obj.getDatabase(object);
|
|
20
|
+
|
|
21
|
+
const [selectedId, setSelectedId] = useState<ObjectId | null>(null);
|
|
22
|
+
const [selectedObject] = useQuery(
|
|
23
|
+
db,
|
|
24
|
+
Query.select(Filter.id(selectedId ?? object.id)).options({ deleted: 'include' }),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<Clipboard.Provider>
|
|
29
|
+
<Panel.Root>
|
|
30
|
+
<Panel.Content asChild>
|
|
31
|
+
<Grid rows={db ? 2 : 1} classNames='divide-y divide-separator'>
|
|
32
|
+
{db && (
|
|
33
|
+
<ScrollArea.Root>
|
|
34
|
+
<ScrollArea.Viewport>
|
|
35
|
+
<ObjectsTree db={db} root={object} onSelect={(entity) => setSelectedId(entity.id)} />
|
|
36
|
+
</ScrollArea.Viewport>
|
|
37
|
+
</ScrollArea.Root>
|
|
38
|
+
)}
|
|
39
|
+
<Json data={selectedObject} />
|
|
40
|
+
</Grid>
|
|
41
|
+
</Panel.Content>
|
|
42
|
+
</Panel.Root>
|
|
43
|
+
</Clipboard.Provider>
|
|
44
|
+
);
|
|
45
|
+
};
|