@dxos/plugin-debug 0.8.4-main.ae835ea → 0.8.4-main.bcb3aa67d6
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/index.mjs +101 -100
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- 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.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 +12 -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 +8 -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 +79 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings/index.d.ts +3 -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 +5 -5
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/index.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/index.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +2 -5
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +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 +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/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/containers/SpaceGenerator/SpaceGenerator.d.ts +15 -0
- 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 +9 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +60 -58
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +6 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +67 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +83 -70
- package/src/DebugPlugin.tsx +31 -33
- package/src/capabilities/app-graph-builder.ts +363 -388
- package/src/capabilities/index.ts +5 -5
- package/src/capabilities/react-context.tsx +16 -7
- package/src/capabilities/react-surface.tsx +360 -337
- package/src/capabilities/settings.ts +24 -12
- package/src/components/DebugSettings/DebugSettings.stories.tsx +36 -0
- package/src/components/DebugSettings/DebugSettings.tsx +228 -0
- package/src/components/DebugSettings/index.ts +7 -0
- package/src/components/SchemaTable/index.ts +5 -0
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +21 -23
- package/src/components/SpaceGenerator/index.ts +2 -3
- package/src/components/SpaceGenerator/presets.ts +243 -121
- package/src/components/index.ts +4 -8
- package/src/containers/DebugGraph/DebugGraph.tsx +13 -0
- package/src/containers/DebugGraph/index.ts +7 -0
- package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +47 -0
- package/src/containers/DebugObjectPanel/index.ts +7 -0
- package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +55 -0
- package/src/containers/DebugSpaceObjectsPanel/index.ts +7 -0
- package/src/{components → containers/DebugStatus}/DebugStatus.tsx +41 -17
- package/src/containers/DebugStatus/index.ts +7 -0
- package/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx +25 -0
- package/src/containers/DevtoolsOverviewContainer/index.ts +7 -0
- package/src/containers/SpaceGenerator/SpaceGenerator.tsx +130 -0
- package/src/containers/SpaceGenerator/index.ts +7 -0
- package/src/{components → containers/Wireframe}/Wireframe.tsx +6 -7
- package/src/containers/Wireframe/index.ts +7 -0
- package/src/containers/index.ts +13 -0
- package/src/meta.ts +3 -3
- package/src/translations.ts +66 -58
- package/src/types/Settings.ts +15 -0
- package/src/{types.ts → types/index.ts} +12 -10
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +0 -20
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +0 -7
- package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs +0 -25
- package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-7Q7CX64P.mjs +0 -1159
- package/dist/lib/browser/SpaceGenerator-7Q7CX64P.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-RXWTHLEW.mjs +0 -588
- package/dist/lib/browser/app-graph-builder-RXWTHLEW.mjs.map +0 -7
- package/dist/lib/browser/chunk-SRV2AIGJ.mjs +0 -68
- 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/react-context-P2YDWEWI.mjs +0 -16
- package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +0 -7
- package/dist/lib/browser/react-surface-4XGZUT3Z.mjs +0 -772
- package/dist/lib/browser/react-surface-4XGZUT3Z.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.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 -159
- 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
- /package/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.tsx +0 -0
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { AgentPrompt, EntityExtraction, ResearchBlueprint } from '@dxos/assistant-toolkit';
|
|
8
8
|
import { Prompt } from '@dxos/blueprints';
|
|
9
9
|
import { type ComputeGraphModel, NODE_INPUT } from '@dxos/conductor';
|
|
10
|
-
import { DXN, Filter, Key, Obj, Query, Ref, Tag
|
|
11
|
-
import { Trigger
|
|
10
|
+
import { DXN, Feed, Filter, JsonSchema, Key, Obj, Query, type QueryAST, Ref, Tag } from '@dxos/echo';
|
|
11
|
+
import { Trigger } from '@dxos/functions';
|
|
12
12
|
import { invariant } from '@dxos/invariant';
|
|
13
|
-
import {
|
|
13
|
+
import { Operation } from '@dxos/operation';
|
|
14
|
+
import { InboxOperation } from '@dxos/plugin-inbox';
|
|
14
15
|
import { Mailbox } from '@dxos/plugin-inbox/types';
|
|
15
16
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
16
17
|
import { type Space } from '@dxos/react-client/echo';
|
|
@@ -20,23 +21,18 @@ import {
|
|
|
20
21
|
createChat,
|
|
21
22
|
createComputeGraph,
|
|
22
23
|
createConstant,
|
|
24
|
+
createFeed,
|
|
23
25
|
createFunction,
|
|
24
26
|
createGpt,
|
|
25
|
-
createQueue,
|
|
26
27
|
createRandom,
|
|
27
28
|
createSurface,
|
|
28
29
|
createTemplate,
|
|
29
30
|
createText,
|
|
30
31
|
createTrigger,
|
|
31
32
|
} 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 { DataType, createView } from '@dxos/schema';
|
|
33
|
+
import { CanvasBoard, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from '@dxos/react-ui-canvas-editor';
|
|
34
|
+
import { ViewModel } from '@dxos/schema';
|
|
35
|
+
import { Message, Organization, Person, Pipeline } from '@dxos/types';
|
|
40
36
|
import { range, trim } from '@dxos/util';
|
|
41
37
|
|
|
42
38
|
import { type ObjectGenerator } from './ObjectGenerator';
|
|
@@ -49,32 +45,39 @@ export enum PresetName {
|
|
|
49
45
|
CHAT_GPT = 'chat-gpt-text',
|
|
50
46
|
// EMAIL_WITH_SUMMARY = 'email-gptSummary-table',
|
|
51
47
|
OBJECT_CHANGE_QUEUE = 'objectChange-queue',
|
|
52
|
-
FOREX_FUNCTION_CALL = 'forex-function-call',
|
|
53
48
|
TIMER_TICK_QUEUE = 'timerTick-queue',
|
|
49
|
+
FOREX_FUNCTION_CALL = 'forex-function-call',
|
|
54
50
|
DISCORD_MESSAGES = 'discord-messages',
|
|
55
51
|
// KANBAN_QUEUE = 'kanban-queue',
|
|
56
52
|
}
|
|
57
53
|
|
|
58
54
|
export const generator = () => ({
|
|
59
|
-
schemas: [
|
|
55
|
+
schemas: [CanvasBoard.CanvasBoard, Trigger.Trigger] as any[],
|
|
60
56
|
types: Object.values(PresetName).map((name) => ({ typename: name })),
|
|
61
57
|
items: [
|
|
62
58
|
[
|
|
63
59
|
PresetName.DXOS_TEAM,
|
|
64
60
|
async (space, n, cb) => {
|
|
65
61
|
const objects = range(n, () => {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
const org = space.db.add(
|
|
63
|
+
Obj.make(Organization.Organization, {
|
|
64
|
+
name: 'DXOS',
|
|
65
|
+
website: 'https://dxos.org',
|
|
66
|
+
}),
|
|
67
|
+
);
|
|
71
68
|
const doc = space.db.add(
|
|
72
|
-
Markdown.
|
|
69
|
+
Markdown.make({
|
|
73
70
|
name: 'DXOS Research',
|
|
74
71
|
content: 'DXOS builds Composer, an open-source AI-powered malleable application.',
|
|
75
72
|
}),
|
|
76
73
|
);
|
|
77
|
-
|
|
74
|
+
|
|
75
|
+
const tag = space.db.add(Tag.make({ label: 'Investor' }));
|
|
76
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
77
|
+
Obj.change(doc, (obj) => {
|
|
78
|
+
Obj.getMeta(obj).tags = [tagDxn];
|
|
79
|
+
});
|
|
80
|
+
|
|
78
81
|
// space.db.add(
|
|
79
82
|
// Relation.make(HasSubject, {
|
|
80
83
|
// [Relation.Source]: doc,
|
|
@@ -84,12 +87,26 @@ export const generator = () => ({
|
|
|
84
87
|
// );
|
|
85
88
|
|
|
86
89
|
space.db.add(
|
|
87
|
-
Obj.make(
|
|
90
|
+
Obj.make(Person.Person, { [Obj.Meta]: { tags: [tagDxn] }, fullName: 'Rich', organization: Ref.make(org) }),
|
|
91
|
+
);
|
|
92
|
+
space.db.add(
|
|
93
|
+
Obj.make(Person.Person, {
|
|
94
|
+
fullName: 'Josiah',
|
|
95
|
+
organization: Ref.make(org),
|
|
96
|
+
}),
|
|
97
|
+
);
|
|
98
|
+
space.db.add(
|
|
99
|
+
Obj.make(Person.Person, {
|
|
100
|
+
fullName: 'Dima',
|
|
101
|
+
organization: Ref.make(org),
|
|
102
|
+
}),
|
|
103
|
+
);
|
|
104
|
+
space.db.add(
|
|
105
|
+
Obj.make(Person.Person, {
|
|
106
|
+
fullName: 'Mykola',
|
|
107
|
+
organization: Ref.make(org),
|
|
108
|
+
}),
|
|
88
109
|
);
|
|
89
|
-
space.db.add(Obj.make(DataType.Person, { fullName: 'Josiah', organization: Ref.make(org) }));
|
|
90
|
-
space.db.add(Obj.make(DataType.Person, { fullName: 'Dima', organization: Ref.make(org) }));
|
|
91
|
-
space.db.add(Obj.make(DataType.Person, { fullName: 'Mykola', organization: Ref.make(org) }));
|
|
92
|
-
space.db.add(Obj.make(DataType.Person, { fullName: 'Will', organization: Ref.make(org) }));
|
|
93
110
|
|
|
94
111
|
return doc;
|
|
95
112
|
});
|
|
@@ -100,41 +117,49 @@ export const generator = () => ({
|
|
|
100
117
|
[
|
|
101
118
|
PresetName.ORG_RESEARCH_PROJECT,
|
|
102
119
|
async (space, n, cb) => {
|
|
103
|
-
const
|
|
120
|
+
const mailboxes = await space.db.query(Filter.type(Mailbox.Mailbox)).run();
|
|
121
|
+
const mailbox = mailboxes[0];
|
|
122
|
+
invariant(mailbox, 'Mailbox not found');
|
|
123
|
+
const mailboxFeed = await mailbox.feed?.tryLoad();
|
|
124
|
+
invariant(mailboxFeed, 'Mailbox missing feed reference');
|
|
125
|
+
const queueDxn = Feed.getQueueDxn(mailboxFeed)?.toString();
|
|
126
|
+
invariant(queueDxn, 'Mailbox feed missing queue DXN key');
|
|
104
127
|
const tag = await space.db.query(Filter.type(Tag.Tag, { label: 'Investor' })).first();
|
|
105
128
|
const tagDxn = Obj.getDXN(tag).toString();
|
|
106
129
|
|
|
107
130
|
const objects = range(n, () => {
|
|
108
|
-
const contactsQuery = Query.select(Filter.type(
|
|
109
|
-
const organizationsQuery = Query.select(Filter.type(
|
|
131
|
+
const contactsQuery = Query.select(Filter.type(Person.Person)).select(Filter.tag(tagDxn));
|
|
132
|
+
const organizationsQuery = Query.select(Filter.type(Organization.Organization)).select(Filter.tag(tagDxn));
|
|
110
133
|
const notesQuery = Query.select(Filter.type(Markdown.Document)).select(Filter.tag(tagDxn));
|
|
111
134
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
space.db.add(
|
|
136
|
+
Trigger.make({
|
|
137
|
+
enabled: true,
|
|
138
|
+
spec: {
|
|
139
|
+
kind: 'timer',
|
|
140
|
+
cron: '* * * * *', // Every minute.
|
|
141
|
+
},
|
|
142
|
+
function: Ref.make(Operation.serialize(InboxOperation.GoogleMailSync)),
|
|
143
|
+
input: {
|
|
144
|
+
mailbox: Ref.make(mailbox),
|
|
145
|
+
},
|
|
146
|
+
}),
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
space.db.add(
|
|
150
|
+
Trigger.make({
|
|
151
|
+
enabled: true,
|
|
152
|
+
// TODO(wittjosiah): Queue trigger doesn't support matching query of the column.
|
|
153
|
+
spec: {
|
|
154
|
+
kind: 'queue',
|
|
155
|
+
queue: queueDxn,
|
|
156
|
+
},
|
|
157
|
+
function: Ref.make(Operation.serialize(EntityExtraction)),
|
|
158
|
+
input: {
|
|
159
|
+
source: '{{event.item}}',
|
|
160
|
+
},
|
|
161
|
+
}),
|
|
162
|
+
);
|
|
138
163
|
|
|
139
164
|
const researchPrompt = space.db.add(
|
|
140
165
|
Prompt.make({
|
|
@@ -152,59 +177,75 @@ export const generator = () => ({
|
|
|
152
177
|
Create a research note for it at the end.
|
|
153
178
|
NOTE: Do mocked reseach (set mockSearch to true).
|
|
154
179
|
`,
|
|
155
|
-
blueprints: [Ref.make(ResearchBlueprint)],
|
|
180
|
+
blueprints: [Ref.make(ResearchBlueprint.make())],
|
|
156
181
|
}),
|
|
157
182
|
);
|
|
158
183
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
184
|
+
space.db.add(
|
|
185
|
+
Trigger.make({
|
|
186
|
+
enabled: true,
|
|
187
|
+
spec: {
|
|
188
|
+
kind: 'subscription',
|
|
189
|
+
query: {
|
|
190
|
+
ast: organizationsQuery.ast,
|
|
191
|
+
},
|
|
165
192
|
},
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
space.db.add(researchTrigger);
|
|
193
|
+
function: Ref.make(Operation.serialize(AgentPrompt)),
|
|
194
|
+
input: {
|
|
195
|
+
prompt: Ref.make(researchPrompt),
|
|
196
|
+
input: '{{event.subject}}',
|
|
197
|
+
},
|
|
198
|
+
}),
|
|
199
|
+
);
|
|
174
200
|
|
|
175
|
-
const mailboxView =
|
|
176
|
-
name: 'Mailbox',
|
|
201
|
+
const mailboxView = ViewModel.make({
|
|
177
202
|
query: Query.select(
|
|
178
|
-
Filter.type(
|
|
179
|
-
|
|
180
|
-
|
|
203
|
+
Filter.type(Message.Message, {
|
|
204
|
+
properties: { labels: Filter.contains('investor') },
|
|
205
|
+
}),
|
|
206
|
+
).from({
|
|
207
|
+
queues: [queueDxn],
|
|
181
208
|
}),
|
|
182
|
-
jsonSchema:
|
|
183
|
-
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
209
|
+
jsonSchema: JsonSchema.toJsonSchema(Message.Message),
|
|
184
210
|
});
|
|
185
|
-
const contactsView =
|
|
186
|
-
name: 'Contacts',
|
|
211
|
+
const contactsView = ViewModel.make({
|
|
187
212
|
query: contactsQuery,
|
|
188
|
-
jsonSchema:
|
|
189
|
-
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
213
|
+
jsonSchema: JsonSchema.toJsonSchema(Person.Person),
|
|
190
214
|
});
|
|
191
|
-
const organizationsView =
|
|
192
|
-
name: 'Organizations',
|
|
215
|
+
const organizationsView = ViewModel.make({
|
|
193
216
|
query: organizationsQuery,
|
|
194
|
-
jsonSchema:
|
|
195
|
-
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
217
|
+
jsonSchema: JsonSchema.toJsonSchema(Organization.Organization),
|
|
196
218
|
});
|
|
197
|
-
const notesView =
|
|
198
|
-
name: 'Notes',
|
|
219
|
+
const notesView = ViewModel.make({
|
|
199
220
|
query: notesQuery,
|
|
200
|
-
jsonSchema:
|
|
201
|
-
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
221
|
+
jsonSchema: JsonSchema.toJsonSchema(Markdown.Document),
|
|
202
222
|
});
|
|
203
223
|
|
|
204
224
|
return space.db.add(
|
|
205
|
-
|
|
225
|
+
Pipeline.make({
|
|
206
226
|
name: 'Investor Research',
|
|
207
|
-
|
|
227
|
+
columns: [
|
|
228
|
+
{
|
|
229
|
+
name: 'Mailbox',
|
|
230
|
+
view: Ref.make(mailboxView),
|
|
231
|
+
order: [],
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: 'Contacts',
|
|
235
|
+
view: Ref.make(contactsView),
|
|
236
|
+
order: [],
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
name: 'Organizations',
|
|
240
|
+
view: Ref.make(organizationsView),
|
|
241
|
+
order: [],
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: 'Notes',
|
|
245
|
+
view: Ref.make(notesView),
|
|
246
|
+
order: [],
|
|
247
|
+
},
|
|
248
|
+
],
|
|
208
249
|
}),
|
|
209
250
|
);
|
|
210
251
|
});
|
|
@@ -233,10 +274,24 @@ export const generator = () => ({
|
|
|
233
274
|
const append = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
|
|
234
275
|
|
|
235
276
|
builder
|
|
236
|
-
.createEdge({
|
|
277
|
+
.createEdge({
|
|
278
|
+
source: trigger.id,
|
|
279
|
+
target: gpt.id,
|
|
280
|
+
input: 'prompt',
|
|
281
|
+
output: 'bodyText',
|
|
282
|
+
})
|
|
237
283
|
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
238
|
-
.createEdge({
|
|
239
|
-
|
|
284
|
+
.createEdge({
|
|
285
|
+
source: queueId.id,
|
|
286
|
+
target: append.id,
|
|
287
|
+
input: 'id',
|
|
288
|
+
})
|
|
289
|
+
.createEdge({
|
|
290
|
+
source: gpt.id,
|
|
291
|
+
target: append.id,
|
|
292
|
+
output: 'messages',
|
|
293
|
+
input: 'items',
|
|
294
|
+
});
|
|
240
295
|
|
|
241
296
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
242
297
|
});
|
|
@@ -261,7 +316,7 @@ export const generator = () => ({
|
|
|
261
316
|
'subscription',
|
|
262
317
|
(triggerSpec) =>
|
|
263
318
|
(triggerSpec.query = {
|
|
264
|
-
ast: Query.select(Filter.typename('dxos.
|
|
319
|
+
ast: Query.select(Filter.typename('org.dxos.type.chess')).ast as Obj.Mutable<QueryAST.Query>,
|
|
265
320
|
}),
|
|
266
321
|
'type',
|
|
267
322
|
);
|
|
@@ -346,7 +401,7 @@ export const generator = () => ({
|
|
|
346
401
|
// const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
347
402
|
// invariant(templateComputeNode, 'Template compute node was not created.');
|
|
348
403
|
// templateComputeNode.value = templateContent.join('\n');
|
|
349
|
-
// templateComputeNode.inputSchema =
|
|
404
|
+
// templateComputeNode.inputSchema = JsonSchema.toJsonSchema(EmailTriggerOutput);
|
|
350
405
|
|
|
351
406
|
// attachTrigger(functionTrigger, computeModel);
|
|
352
407
|
|
|
@@ -374,8 +429,17 @@ export const generator = () => ({
|
|
|
374
429
|
builder
|
|
375
430
|
.createEdge({ source: chat.id, target: gpt.id, input: 'prompt' })
|
|
376
431
|
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
377
|
-
.createEdge({
|
|
378
|
-
|
|
432
|
+
.createEdge({
|
|
433
|
+
source: queueId.id,
|
|
434
|
+
target: append.id,
|
|
435
|
+
input: 'id',
|
|
436
|
+
})
|
|
437
|
+
.createEdge({
|
|
438
|
+
source: gpt.id,
|
|
439
|
+
target: append.id,
|
|
440
|
+
output: 'messages',
|
|
441
|
+
input: 'items',
|
|
442
|
+
});
|
|
379
443
|
});
|
|
380
444
|
|
|
381
445
|
const computeModel = createComputeGraph(canvasModel);
|
|
@@ -471,7 +535,7 @@ export const generator = () => ({
|
|
|
471
535
|
// invariant(templateComputeNode, 'Template compute node was not created.');
|
|
472
536
|
// templateComputeNode.value = templateContent.join('\n');
|
|
473
537
|
// const extendedSchema = Schema.extend(EmailTriggerOutput, Schema.Struct({ text: Schema.String }));
|
|
474
|
-
// templateComputeNode.inputSchema =
|
|
538
|
+
// templateComputeNode.inputSchema = JsonSchema.toJsonSchema(extendedSchema);
|
|
475
539
|
|
|
476
540
|
// attachTrigger(functionTrigger, computeModel);
|
|
477
541
|
|
|
@@ -499,9 +563,21 @@ export const generator = () => ({
|
|
|
499
563
|
const view = canvasModel.createNode(createSurface(position({ x: 12, y: 0 })));
|
|
500
564
|
|
|
501
565
|
builder
|
|
502
|
-
.createEdge({
|
|
503
|
-
|
|
504
|
-
|
|
566
|
+
.createEdge({
|
|
567
|
+
source: sourceCurrency.id,
|
|
568
|
+
target: converter.id,
|
|
569
|
+
input: 'from',
|
|
570
|
+
})
|
|
571
|
+
.createEdge({
|
|
572
|
+
source: targetCurrency.id,
|
|
573
|
+
target: converter.id,
|
|
574
|
+
input: 'to',
|
|
575
|
+
})
|
|
576
|
+
.createEdge({
|
|
577
|
+
source: converter.id,
|
|
578
|
+
target: view.id,
|
|
579
|
+
output: 'rate',
|
|
580
|
+
});
|
|
505
581
|
});
|
|
506
582
|
|
|
507
583
|
const computeModel = createComputeGraph(canvasModel);
|
|
@@ -529,7 +605,10 @@ export const generator = () => ({
|
|
|
529
605
|
const trigger = canvasModel.createNode(triggerShape);
|
|
530
606
|
// DXOS dev-null channel.
|
|
531
607
|
const channelId = canvasModel.createNode(
|
|
532
|
-
createConstant({
|
|
608
|
+
createConstant({
|
|
609
|
+
value: '1088569858767212554',
|
|
610
|
+
...position({ x: -10, y: 0 }),
|
|
611
|
+
}),
|
|
533
612
|
);
|
|
534
613
|
const queueId = canvasModel.createNode(
|
|
535
614
|
createConstant({
|
|
@@ -539,14 +618,34 @@ export const generator = () => ({
|
|
|
539
618
|
);
|
|
540
619
|
const converter = canvasModel.createNode(createFunction(position({ x: 0, y: 0 })));
|
|
541
620
|
const view = canvasModel.createNode(createText(position({ x: 12, y: 0 })));
|
|
542
|
-
const queue = canvasModel.createNode(
|
|
621
|
+
const queue = canvasModel.createNode(createFeed(position({ x: 0, y: 12 })));
|
|
543
622
|
|
|
544
623
|
builder
|
|
545
|
-
.createEdge({
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
624
|
+
.createEdge({
|
|
625
|
+
source: trigger.id,
|
|
626
|
+
target: converter.id,
|
|
627
|
+
input: 'tick',
|
|
628
|
+
})
|
|
629
|
+
.createEdge({
|
|
630
|
+
source: channelId.id,
|
|
631
|
+
target: converter.id,
|
|
632
|
+
input: 'channelId',
|
|
633
|
+
})
|
|
634
|
+
.createEdge({
|
|
635
|
+
source: queueId.id,
|
|
636
|
+
target: converter.id,
|
|
637
|
+
input: 'queueId',
|
|
638
|
+
})
|
|
639
|
+
.createEdge({
|
|
640
|
+
source: converter.id,
|
|
641
|
+
target: view.id,
|
|
642
|
+
output: 'newMessages',
|
|
643
|
+
})
|
|
644
|
+
.createEdge({
|
|
645
|
+
source: queueId.id,
|
|
646
|
+
target: queue.id,
|
|
647
|
+
input: 'input',
|
|
648
|
+
});
|
|
550
649
|
|
|
551
650
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
552
651
|
});
|
|
@@ -616,7 +715,7 @@ export const generator = () => ({
|
|
|
616
715
|
const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
617
716
|
space: Space,
|
|
618
717
|
triggerKind: SpecType,
|
|
619
|
-
initSpec: (spec: Extract<Trigger.Spec, { kind: SpecType }
|
|
718
|
+
initSpec: (spec: Obj.Mutable<Extract<Trigger.Spec, { kind: SpecType }>>) => void,
|
|
620
719
|
triggerOutputName: string,
|
|
621
720
|
) => {
|
|
622
721
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
@@ -649,7 +748,12 @@ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
|
649
748
|
builder
|
|
650
749
|
.createEdge({ source: queueId.id, target: append.id, input: 'id' })
|
|
651
750
|
.createEdge({ source: template.id, target: append.id, input: 'items' })
|
|
652
|
-
.createEdge({
|
|
751
|
+
.createEdge({
|
|
752
|
+
source: trigger.id,
|
|
753
|
+
target: template.id,
|
|
754
|
+
output: triggerOutputName,
|
|
755
|
+
input: 'type',
|
|
756
|
+
})
|
|
653
757
|
.createEdge({
|
|
654
758
|
source: random.id,
|
|
655
759
|
target: template.id,
|
|
@@ -659,15 +763,20 @@ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
|
659
763
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
660
764
|
const triggerSpec = functionTrigger.spec;
|
|
661
765
|
invariant(triggerSpec && triggerSpec.kind === triggerKind, 'No trigger spec.');
|
|
662
|
-
|
|
766
|
+
Obj.change(functionTrigger, (ft) => {
|
|
767
|
+
initSpec(ft.spec as any);
|
|
768
|
+
});
|
|
663
769
|
});
|
|
664
770
|
|
|
665
771
|
const computeModel = createComputeGraph(canvasModel);
|
|
666
772
|
|
|
667
773
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
668
774
|
invariant(templateComputeNode, 'Template compute node was not created.');
|
|
775
|
+
// NOTE: These are plain object mutations during model construction, not ECHO object mutations.
|
|
669
776
|
templateComputeNode.value = ['{', ' "@type": "{{type}}",', ' "id": "@{{changeId}}"', '}'].join('\n');
|
|
670
|
-
templateComputeNode.inputSchema =
|
|
777
|
+
templateComputeNode.inputSchema = JsonSchema.toJsonSchema(
|
|
778
|
+
Schema.Struct({ type: Schema.String, changeId: Schema.String }),
|
|
779
|
+
);
|
|
671
780
|
attachTrigger(functionTrigger, computeModel);
|
|
672
781
|
|
|
673
782
|
return { canvasModel, computeModel };
|
|
@@ -675,7 +784,7 @@ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
|
675
784
|
|
|
676
785
|
const addToSpace = (name: string, space: Space, canvas: CanvasGraphModel, compute: ComputeGraphModel) => {
|
|
677
786
|
return space.db.add(
|
|
678
|
-
Obj.make(
|
|
787
|
+
Obj.make(CanvasBoard.CanvasBoard, {
|
|
679
788
|
name,
|
|
680
789
|
computeGraph: Ref.make(compute.root),
|
|
681
790
|
layout: canvas.graph,
|
|
@@ -695,7 +804,7 @@ const setupQueue = (
|
|
|
695
804
|
}),
|
|
696
805
|
);
|
|
697
806
|
const queue = canvasModel.createNode(
|
|
698
|
-
|
|
807
|
+
createFeed(
|
|
699
808
|
args?.queuePosition ? rawPosition(args.queuePosition) : position({ x: -3, y: 3, width: 14, height: 10 }),
|
|
700
809
|
),
|
|
701
810
|
);
|
|
@@ -705,15 +814,25 @@ const setupQueue = (
|
|
|
705
814
|
|
|
706
815
|
const attachTrigger = (functionTrigger: Trigger.Trigger | undefined, computeModel: ComputeGraphModel) => {
|
|
707
816
|
invariant(functionTrigger);
|
|
708
|
-
functionTrigger.function = Ref.make(computeModel.root);
|
|
709
817
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
|
|
710
|
-
functionTrigger
|
|
818
|
+
Obj.change(functionTrigger, (obj) => {
|
|
819
|
+
obj.function = Ref.make(computeModel.root);
|
|
820
|
+
obj.inputNodeId = inputNode.id;
|
|
821
|
+
});
|
|
711
822
|
};
|
|
712
823
|
|
|
713
|
-
type RawPositionInput = {
|
|
824
|
+
type RawPositionInput = {
|
|
825
|
+
centerX: number;
|
|
826
|
+
centerY: number;
|
|
827
|
+
width: number;
|
|
828
|
+
height: number;
|
|
829
|
+
};
|
|
714
830
|
|
|
715
831
|
const rawPosition = (args: RawPositionInput) => {
|
|
716
|
-
return {
|
|
832
|
+
return {
|
|
833
|
+
center: { x: args.centerX, y: args.centerY },
|
|
834
|
+
size: { width: args.width, height: args.height },
|
|
835
|
+
};
|
|
717
836
|
};
|
|
718
837
|
|
|
719
838
|
const position = (rect: { x: number; y: number; width?: number; height?: number }) => {
|
|
@@ -721,7 +840,10 @@ const position = (rect: { x: number; y: number; width?: number; height?: number
|
|
|
721
840
|
const [center, size] = rectToPoints({ width: 0, height: 0, ...rect });
|
|
722
841
|
const { x, y, width, height } = pointsToRect([pointMultiply(center, snap), pointMultiply(size, snap)]);
|
|
723
842
|
if (width && height) {
|
|
724
|
-
return {
|
|
843
|
+
return {
|
|
844
|
+
center: { x, y },
|
|
845
|
+
size: width && height ? { width, height } : undefined,
|
|
846
|
+
};
|
|
725
847
|
} else {
|
|
726
848
|
return { center: { x, y } };
|
|
727
849
|
}
|
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,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,47 @@
|
|
|
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, Toolbar } 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
|
+
const [selectedId, setSelectedId] = useState<ObjectId | null>(null);
|
|
21
|
+
const [selectedObject] = useQuery(
|
|
22
|
+
db,
|
|
23
|
+
Query.select(Filter.id(selectedId ?? object.id)).options({ deleted: 'include' }),
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Clipboard.Provider>
|
|
28
|
+
<Panel.Root>
|
|
29
|
+
<Panel.Toolbar asChild>
|
|
30
|
+
<Toolbar.Root />
|
|
31
|
+
</Panel.Toolbar>
|
|
32
|
+
<Panel.Content asChild>
|
|
33
|
+
<Grid rows={db ? 2 : 1} classNames='divide-y divide-separator'>
|
|
34
|
+
{db && (
|
|
35
|
+
<ScrollArea.Root>
|
|
36
|
+
<ScrollArea.Viewport>
|
|
37
|
+
<ObjectsTree db={db} root={object} onSelect={(entity) => setSelectedId(entity.id)} />
|
|
38
|
+
</ScrollArea.Viewport>
|
|
39
|
+
</ScrollArea.Root>
|
|
40
|
+
)}
|
|
41
|
+
<Json.Data data={selectedObject} />
|
|
42
|
+
</Grid>
|
|
43
|
+
</Panel.Content>
|
|
44
|
+
</Panel.Root>
|
|
45
|
+
</Clipboard.Provider>
|
|
46
|
+
);
|
|
47
|
+
};
|