@dxos/plugin-debug 0.8.4-main.1f223c7 → 0.8.4-main.21d9917
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs +15 -0
- package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs.map +7 -0
- package/dist/lib/browser/DevtoolsOverviewContainer-77PKFLYV.mjs +19 -0
- package/dist/lib/browser/DevtoolsOverviewContainer-77PKFLYV.mjs.map +7 -0
- package/dist/lib/browser/{SpaceGenerator-SRCIEELZ.mjs → SpaceGenerator-ZHVZWGM7.mjs} +306 -257
- package/dist/lib/browser/SpaceGenerator-ZHVZWGM7.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-FBDRMMYF.mjs +597 -0
- package/dist/lib/browser/app-graph-builder-FBDRMMYF.mjs.map +7 -0
- package/dist/lib/browser/{chunk-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 +35 -43
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-FSWBT3MH.mjs +17 -0
- package/dist/lib/browser/react-context-FSWBT3MH.mjs.map +7 -0
- package/dist/lib/browser/react-surface-W62RJ32U.mjs +757 -0
- package/dist/lib/browser/react-surface-W62RJ32U.mjs.map +7 -0
- package/dist/lib/browser/settings-KA4GN73K.mjs +31 -0
- package/dist/lib/browser/settings-KA4GN73K.mjs.map +7 -0
- package/dist/types/src/DebugPlugin.d.ts +2 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -8
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context/index.d.ts +7 -0
- package/dist/types/src/capabilities/react-context/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-context/react-context.d.ts +10 -0
- package/dist/types/src/capabilities/react-context/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +3 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +5 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/components/DebugGraph.d.ts +5 -4
- package/dist/types/src/components/DebugGraph.d.ts.map +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts +4 -2
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +5 -5
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +0 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.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/Wireframe.d.ts +2 -2
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +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 +77 -71
- package/src/DebugPlugin.tsx +17 -33
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +419 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/index.ts +4 -6
- package/src/capabilities/react-context/index.ts +7 -0
- package/src/capabilities/react-context/react-context.tsx +20 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +409 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +30 -0
- package/src/components/DebugGraph.tsx +4 -3
- package/src/components/DebugObjectPanel.tsx +6 -8
- package/src/components/DebugSettings.tsx +47 -21
- package/src/components/DebugStatus.tsx +2 -2
- package/src/components/DevtoolsOverviewContainer.tsx +1 -1
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +26 -33
- package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +10 -10
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +21 -16
- package/src/components/SpaceGenerator/draw-util.ts +2 -2
- package/src/components/SpaceGenerator/presets.ts +259 -80
- package/src/components/Wireframe.tsx +4 -5
- package/src/components/index.ts +4 -1
- package/src/meta.ts +8 -7
- package/src/translations.ts +1 -1
- package/src/types.ts +9 -1
- 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-SRCIEELZ.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-JTIEFOWZ.mjs +0 -587
- package/dist/lib/browser/app-graph-builder-JTIEFOWZ.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-HQPOGG33.mjs +0 -773
- package/dist/lib/browser/react-surface-HQPOGG33.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/src/capabilities/app-graph-builder.ts +0 -430
- package/src/capabilities/react-context.tsx +0 -16
- package/src/capabilities/react-surface.tsx +0 -398
- package/src/capabilities/settings.ts +0 -19
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Agent, EntityExtraction, ResearchBlueprint } from '@dxos/assistant-toolkit';
|
|
8
|
+
import { Prompt } from '@dxos/blueprints';
|
|
8
9
|
import { type ComputeGraphModel, NODE_INPUT } from '@dxos/conductor';
|
|
9
|
-
import { DXN, Filter, Key, Obj, Query, Ref,
|
|
10
|
-
import {
|
|
10
|
+
import { DXN, Filter, Key, Obj, Query, Ref, Tag, Type } from '@dxos/echo';
|
|
11
|
+
import { Trigger, serializeFunction } from '@dxos/functions';
|
|
11
12
|
import { invariant } from '@dxos/invariant';
|
|
13
|
+
import { gmail } from '@dxos/plugin-inbox';
|
|
12
14
|
import { Mailbox } from '@dxos/plugin-inbox/types';
|
|
13
15
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
14
16
|
import { type Space } from '@dxos/react-client/echo';
|
|
@@ -34,8 +36,9 @@ import {
|
|
|
34
36
|
pointsToRect,
|
|
35
37
|
rectToPoints,
|
|
36
38
|
} from '@dxos/react-ui-canvas-editor';
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
+
import { View } from '@dxos/schema';
|
|
40
|
+
import { Message, Organization, Person, Project } from '@dxos/types';
|
|
41
|
+
import { range, trim } from '@dxos/util';
|
|
39
42
|
|
|
40
43
|
import { type ObjectGenerator } from './ObjectGenerator';
|
|
41
44
|
|
|
@@ -47,43 +50,66 @@ export enum PresetName {
|
|
|
47
50
|
CHAT_GPT = 'chat-gpt-text',
|
|
48
51
|
// EMAIL_WITH_SUMMARY = 'email-gptSummary-table',
|
|
49
52
|
OBJECT_CHANGE_QUEUE = 'objectChange-queue',
|
|
50
|
-
FOREX_FUNCTION_CALL = 'forex-function-call',
|
|
51
53
|
TIMER_TICK_QUEUE = 'timerTick-queue',
|
|
54
|
+
FOREX_FUNCTION_CALL = 'forex-function-call',
|
|
52
55
|
DISCORD_MESSAGES = 'discord-messages',
|
|
53
56
|
// KANBAN_QUEUE = 'kanban-queue',
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
export const generator = () => ({
|
|
57
|
-
schemas: [CanvasBoardType,
|
|
60
|
+
schemas: [CanvasBoardType, Trigger.Trigger] as any[],
|
|
58
61
|
types: Object.values(PresetName).map((name) => ({ typename: name })),
|
|
59
62
|
items: [
|
|
60
63
|
[
|
|
61
64
|
PresetName.DXOS_TEAM,
|
|
62
65
|
async (space, n, cb) => {
|
|
63
66
|
const objects = range(n, () => {
|
|
64
|
-
const org = space.db.add(
|
|
65
|
-
|
|
67
|
+
const org = space.db.add(
|
|
68
|
+
Obj.make(Organization.Organization, {
|
|
69
|
+
name: 'DXOS',
|
|
70
|
+
website: 'https://dxos.org',
|
|
71
|
+
}),
|
|
72
|
+
);
|
|
66
73
|
const doc = space.db.add(
|
|
67
|
-
Markdown.
|
|
74
|
+
Markdown.make({
|
|
68
75
|
name: 'DXOS Research',
|
|
69
76
|
content: 'DXOS builds Composer, an open-source AI-powered malleable application.',
|
|
70
77
|
}),
|
|
71
78
|
);
|
|
79
|
+
|
|
80
|
+
const tag = space.db.add(Tag.make({ label: 'Investor' }));
|
|
81
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
82
|
+
Obj.change(doc, (d) => {
|
|
83
|
+
Obj.getMeta(d).tags = [tagDxn];
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// space.db.add(
|
|
87
|
+
// Relation.make(HasSubject, {
|
|
88
|
+
// [Relation.Source]: doc,
|
|
89
|
+
// [Relation.Target]: org,
|
|
90
|
+
// completedAt: new Date().toISOString(),
|
|
91
|
+
// }),
|
|
92
|
+
// );
|
|
93
|
+
|
|
94
|
+
space.db.add(Obj.make(Person.Person, { fullName: 'Rich', organization: Ref.make(org) }, { tags: [tagDxn] }));
|
|
72
95
|
space.db.add(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
completedAt: new Date().toISOString(),
|
|
96
|
+
Obj.make(Person.Person, {
|
|
97
|
+
fullName: 'Josiah',
|
|
98
|
+
organization: Ref.make(org),
|
|
77
99
|
}),
|
|
78
100
|
);
|
|
79
|
-
|
|
80
101
|
space.db.add(
|
|
81
|
-
Obj.make(
|
|
102
|
+
Obj.make(Person.Person, {
|
|
103
|
+
fullName: 'Dima',
|
|
104
|
+
organization: Ref.make(org),
|
|
105
|
+
}),
|
|
106
|
+
);
|
|
107
|
+
space.db.add(
|
|
108
|
+
Obj.make(Person.Person, {
|
|
109
|
+
fullName: 'Mykola',
|
|
110
|
+
organization: Ref.make(org),
|
|
111
|
+
}),
|
|
82
112
|
);
|
|
83
|
-
space.db.add(Obj.make(DataType.Person, { fullName: 'Josiah', organization: Ref.make(org) }));
|
|
84
|
-
space.db.add(Obj.make(DataType.Person, { fullName: 'Dima', organization: Ref.make(org) }));
|
|
85
|
-
space.db.add(Obj.make(DataType.Person, { fullName: 'Mykola', organization: Ref.make(org) }));
|
|
86
|
-
space.db.add(Obj.make(DataType.Person, { fullName: 'Will', organization: Ref.make(org) }));
|
|
87
113
|
|
|
88
114
|
return doc;
|
|
89
115
|
});
|
|
@@ -95,59 +121,132 @@ export const generator = () => ({
|
|
|
95
121
|
PresetName.ORG_RESEARCH_PROJECT,
|
|
96
122
|
async (space, n, cb) => {
|
|
97
123
|
const mailbox = await space.db.query(Filter.type(Mailbox.Mailbox)).first();
|
|
124
|
+
const tag = await space.db.query(Filter.type(Tag.Tag, { label: 'Investor' })).first();
|
|
125
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
98
126
|
|
|
99
127
|
const objects = range(n, () => {
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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(gmail.sync)),
|
|
140
|
+
input: {
|
|
141
|
+
mailboxId: Obj.getDXN(mailbox).toString(),
|
|
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: mailbox.queue.dxn.toString(),
|
|
153
|
+
},
|
|
154
|
+
function: Ref.make(serializeFunction(EntityExtraction.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)],
|
|
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(Agent.prompt)),
|
|
191
|
+
input: {
|
|
192
|
+
prompt: Ref.make(researchPrompt),
|
|
193
|
+
input: '{{event.subject}}',
|
|
194
|
+
},
|
|
195
|
+
}),
|
|
196
|
+
);
|
|
114
197
|
|
|
115
|
-
const mailboxView =
|
|
116
|
-
name: 'Mailbox',
|
|
198
|
+
const mailboxView = View.make({
|
|
117
199
|
query: Query.select(
|
|
118
|
-
Filter.type(
|
|
200
|
+
Filter.type(Message.Message, {
|
|
201
|
+
properties: { labels: Filter.contains('investor') },
|
|
202
|
+
}),
|
|
119
203
|
).options({
|
|
120
204
|
queues: [mailbox.queue.dxn.toString()],
|
|
121
205
|
}),
|
|
122
|
-
jsonSchema: Type.toJsonSchema(
|
|
123
|
-
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
206
|
+
jsonSchema: Type.toJsonSchema(Message.Message),
|
|
124
207
|
});
|
|
125
|
-
const contactsView =
|
|
126
|
-
name: 'Contacts',
|
|
208
|
+
const contactsView = View.make({
|
|
127
209
|
query: contactsQuery,
|
|
128
|
-
jsonSchema: Type.toJsonSchema(
|
|
129
|
-
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
210
|
+
jsonSchema: Type.toJsonSchema(Person.Person),
|
|
130
211
|
});
|
|
131
|
-
const organizationsView =
|
|
132
|
-
name: 'Organizations',
|
|
212
|
+
const organizationsView = View.make({
|
|
133
213
|
query: organizationsQuery,
|
|
134
|
-
jsonSchema: Type.toJsonSchema(
|
|
135
|
-
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
214
|
+
jsonSchema: Type.toJsonSchema(Organization.Organization),
|
|
136
215
|
});
|
|
137
|
-
const notesView =
|
|
138
|
-
name: 'Notes',
|
|
216
|
+
const notesView = View.make({
|
|
139
217
|
query: notesQuery,
|
|
140
218
|
jsonSchema: Type.toJsonSchema(Markdown.Document),
|
|
141
|
-
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
142
219
|
});
|
|
143
220
|
|
|
144
221
|
return space.db.add(
|
|
145
|
-
|
|
222
|
+
Project.make({
|
|
146
223
|
name: 'Investor Research',
|
|
147
|
-
|
|
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
|
+
],
|
|
148
246
|
}),
|
|
149
247
|
);
|
|
150
248
|
});
|
|
249
|
+
|
|
151
250
|
cb?.(objects.flat());
|
|
152
251
|
return objects.flat();
|
|
153
252
|
},
|
|
@@ -158,7 +257,7 @@ export const generator = () => ({
|
|
|
158
257
|
const objects = range(n, () => {
|
|
159
258
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
160
259
|
|
|
161
|
-
let functionTrigger:
|
|
260
|
+
let functionTrigger: Trigger.Trigger | undefined;
|
|
162
261
|
canvasModel.builder.call((builder) => {
|
|
163
262
|
const gpt = canvasModel.createNode(createGpt(position({ x: 0, y: -14 })));
|
|
164
263
|
const triggerShape = createTrigger({
|
|
@@ -172,10 +271,24 @@ export const generator = () => ({
|
|
|
172
271
|
const append = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
|
|
173
272
|
|
|
174
273
|
builder
|
|
175
|
-
.createEdge({
|
|
274
|
+
.createEdge({
|
|
275
|
+
source: trigger.id,
|
|
276
|
+
target: gpt.id,
|
|
277
|
+
input: 'prompt',
|
|
278
|
+
output: 'bodyText',
|
|
279
|
+
})
|
|
176
280
|
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
177
|
-
.createEdge({
|
|
178
|
-
|
|
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
|
+
});
|
|
179
292
|
|
|
180
293
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
181
294
|
});
|
|
@@ -198,7 +311,10 @@ export const generator = () => ({
|
|
|
198
311
|
const { canvasModel, computeModel } = createQueueSinkPreset(
|
|
199
312
|
space,
|
|
200
313
|
'subscription',
|
|
201
|
-
(triggerSpec) =>
|
|
314
|
+
(triggerSpec) =>
|
|
315
|
+
(triggerSpec.query = {
|
|
316
|
+
ast: Query.select(Filter.typename('dxos.org/type/Chess')).ast,
|
|
317
|
+
}),
|
|
202
318
|
'type',
|
|
203
319
|
);
|
|
204
320
|
return addToSpace(PresetName.OBJECT_CHANGE_QUEUE, space, canvasModel, computeModel);
|
|
@@ -310,8 +426,17 @@ export const generator = () => ({
|
|
|
310
426
|
builder
|
|
311
427
|
.createEdge({ source: chat.id, target: gpt.id, input: 'prompt' })
|
|
312
428
|
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
313
|
-
.createEdge({
|
|
314
|
-
|
|
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
|
+
});
|
|
315
440
|
});
|
|
316
441
|
|
|
317
442
|
const computeModel = createComputeGraph(canvasModel);
|
|
@@ -435,9 +560,21 @@ export const generator = () => ({
|
|
|
435
560
|
const view = canvasModel.createNode(createSurface(position({ x: 12, y: 0 })));
|
|
436
561
|
|
|
437
562
|
builder
|
|
438
|
-
.createEdge({
|
|
439
|
-
|
|
440
|
-
|
|
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
|
+
});
|
|
441
578
|
});
|
|
442
579
|
|
|
443
580
|
const computeModel = createComputeGraph(canvasModel);
|
|
@@ -455,7 +592,7 @@ export const generator = () => ({
|
|
|
455
592
|
const objects = range(n, () => {
|
|
456
593
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
457
594
|
|
|
458
|
-
let functionTrigger:
|
|
595
|
+
let functionTrigger: Trigger.Trigger | undefined;
|
|
459
596
|
canvasModel.builder.call((builder) => {
|
|
460
597
|
const triggerShape = createTrigger({
|
|
461
598
|
spaceId: space.id,
|
|
@@ -465,7 +602,10 @@ export const generator = () => ({
|
|
|
465
602
|
const trigger = canvasModel.createNode(triggerShape);
|
|
466
603
|
// DXOS dev-null channel.
|
|
467
604
|
const channelId = canvasModel.createNode(
|
|
468
|
-
createConstant({
|
|
605
|
+
createConstant({
|
|
606
|
+
value: '1088569858767212554',
|
|
607
|
+
...position({ x: -10, y: 0 }),
|
|
608
|
+
}),
|
|
469
609
|
);
|
|
470
610
|
const queueId = canvasModel.createNode(
|
|
471
611
|
createConstant({
|
|
@@ -478,11 +618,31 @@ export const generator = () => ({
|
|
|
478
618
|
const queue = canvasModel.createNode(createQueue(position({ x: 0, y: 12 })));
|
|
479
619
|
|
|
480
620
|
builder
|
|
481
|
-
.createEdge({
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
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
|
+
});
|
|
486
646
|
|
|
487
647
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
488
648
|
});
|
|
@@ -549,10 +709,10 @@ export const generator = () => ({
|
|
|
549
709
|
] as [PresetName, ObjectGenerator<any>][],
|
|
550
710
|
});
|
|
551
711
|
|
|
552
|
-
const createQueueSinkPreset = <SpecType extends
|
|
712
|
+
const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
553
713
|
space: Space,
|
|
554
714
|
triggerKind: SpecType,
|
|
555
|
-
initSpec: (spec: Extract<
|
|
715
|
+
initSpec: (spec: Extract<Trigger.Spec, { kind: SpecType }>) => void,
|
|
556
716
|
triggerOutputName: string,
|
|
557
717
|
) => {
|
|
558
718
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
@@ -564,7 +724,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
564
724
|
}),
|
|
565
725
|
);
|
|
566
726
|
|
|
567
|
-
let functionTrigger:
|
|
727
|
+
let functionTrigger: Trigger.Trigger | undefined;
|
|
568
728
|
canvasModel.builder.call((builder) => {
|
|
569
729
|
const triggerShape = createTrigger({
|
|
570
730
|
spaceId: space.id,
|
|
@@ -585,7 +745,12 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
585
745
|
builder
|
|
586
746
|
.createEdge({ source: queueId.id, target: append.id, input: 'id' })
|
|
587
747
|
.createEdge({ source: template.id, target: append.id, input: 'items' })
|
|
588
|
-
.createEdge({
|
|
748
|
+
.createEdge({
|
|
749
|
+
source: trigger.id,
|
|
750
|
+
target: template.id,
|
|
751
|
+
output: triggerOutputName,
|
|
752
|
+
input: 'type',
|
|
753
|
+
})
|
|
589
754
|
.createEdge({
|
|
590
755
|
source: random.id,
|
|
591
756
|
target: template.id,
|
|
@@ -602,6 +767,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
602
767
|
|
|
603
768
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
604
769
|
invariant(templateComputeNode, 'Template compute node was not created.');
|
|
770
|
+
// NOTE: These are plain object mutations during model construction, not ECHO object mutations.
|
|
605
771
|
templateComputeNode.value = ['{', ' "@type": "{{type}}",', ' "id": "@{{changeId}}"', '}'].join('\n');
|
|
606
772
|
templateComputeNode.inputSchema = Type.toJsonSchema(Schema.Struct({ type: Schema.String, changeId: Schema.String }));
|
|
607
773
|
attachTrigger(functionTrigger, computeModel);
|
|
@@ -639,17 +805,27 @@ const setupQueue = (
|
|
|
639
805
|
return { queue, queueId };
|
|
640
806
|
};
|
|
641
807
|
|
|
642
|
-
const attachTrigger = (functionTrigger:
|
|
808
|
+
const attachTrigger = (functionTrigger: Trigger.Trigger | undefined, computeModel: ComputeGraphModel) => {
|
|
643
809
|
invariant(functionTrigger);
|
|
644
|
-
functionTrigger.function = Ref.make(computeModel.root);
|
|
645
810
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
|
|
646
|
-
functionTrigger
|
|
811
|
+
Obj.change(functionTrigger, (t) => {
|
|
812
|
+
t.function = Ref.make(computeModel.root);
|
|
813
|
+
t.inputNodeId = inputNode.id;
|
|
814
|
+
});
|
|
647
815
|
};
|
|
648
816
|
|
|
649
|
-
type RawPositionInput = {
|
|
817
|
+
type RawPositionInput = {
|
|
818
|
+
centerX: number;
|
|
819
|
+
centerY: number;
|
|
820
|
+
width: number;
|
|
821
|
+
height: number;
|
|
822
|
+
};
|
|
650
823
|
|
|
651
824
|
const rawPosition = (args: RawPositionInput) => {
|
|
652
|
-
return {
|
|
825
|
+
return {
|
|
826
|
+
center: { x: args.centerX, y: args.centerY },
|
|
827
|
+
size: { width: args.width, height: args.height },
|
|
828
|
+
};
|
|
653
829
|
};
|
|
654
830
|
|
|
655
831
|
const position = (rect: { x: number; y: number; width?: number; height?: number }) => {
|
|
@@ -657,7 +833,10 @@ const position = (rect: { x: number; y: number; width?: number; height?: number
|
|
|
657
833
|
const [center, size] = rectToPoints({ width: 0, height: 0, ...rect });
|
|
658
834
|
const { x, y, width, height } = pointsToRect([pointMultiply(center, snap), pointMultiply(size, snap)]);
|
|
659
835
|
if (width && height) {
|
|
660
|
-
return {
|
|
836
|
+
return {
|
|
837
|
+
center: { x, y },
|
|
838
|
+
size: width && height ? { width, height } : undefined,
|
|
839
|
+
};
|
|
661
840
|
} else {
|
|
662
841
|
return { center: { x, y } };
|
|
663
842
|
}
|
|
@@ -5,22 +5,21 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { useResizeDetector } from 'react-resize-detector';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
10
9
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
11
10
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
12
11
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
13
|
-
import { mx } from '@dxos/
|
|
12
|
+
import { mx } from '@dxos/ui-theme';
|
|
14
13
|
|
|
15
14
|
// TODO(burdon): Create generic container with wireframe mode.
|
|
16
15
|
export type WireframeProps = ThemedClassName<{
|
|
16
|
+
object: Obj.Unknown;
|
|
17
17
|
label?: string;
|
|
18
|
-
object: Obj.Any;
|
|
19
18
|
}>;
|
|
20
19
|
|
|
21
20
|
// TODO(burdon): Make focusable and attendable with input.
|
|
22
21
|
export const Wireframe = ({ classNames, label, object }: WireframeProps) => {
|
|
23
|
-
const attentionAttrs = useAttentionAttributes(
|
|
22
|
+
const attentionAttrs = useAttentionAttributes(Obj.getDXN(object).toString());
|
|
24
23
|
const { width, height, ref } = useResizeDetector();
|
|
25
24
|
|
|
26
25
|
return (
|
package/src/components/index.ts
CHANGED
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { lazy } from 'react';
|
|
6
|
+
import { type FC } from 'react';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
import { type DebugGraphProps } from './DebugGraph';
|
|
9
|
+
|
|
10
|
+
export const DebugGraph: ReturnType<typeof lazy<FC<DebugGraphProps>>> = lazy(() => import('./DebugGraph'));
|
|
8
11
|
export const DevtoolsOverviewContainer = lazy(() => import('./DevtoolsOverviewContainer'));
|
|
9
12
|
export const SpaceGenerator = lazy(() => import('./SpaceGenerator'));
|
|
10
13
|
|
package/src/meta.ts
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
export const meta: PluginMeta = {
|
|
10
|
-
id: DEBUG_PLUGIN,
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'dxos.org/plugin/debug',
|
|
11
10
|
name: 'Debug',
|
|
12
|
-
description:
|
|
13
|
-
|
|
11
|
+
description: trim`
|
|
12
|
+
Comprehensive developer toolkit for troubleshooting applications, generating test data, and exploring automation capabilities.
|
|
13
|
+
Inspect objects, monitor events, and debug plugin behavior in real-time.
|
|
14
|
+
`,
|
|
14
15
|
icon: 'ph--bug--regular',
|
|
15
16
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-debug',
|
|
16
17
|
screenshots: ['https://dxos.network/plugin-details-debug-dark.png'],
|
package/src/translations.ts
CHANGED
|
@@ -16,7 +16,7 @@ export const translations = [
|
|
|
16
16
|
'mutation period': 'Mutation period',
|
|
17
17
|
'open devtools label': 'Open DevTools',
|
|
18
18
|
'devtools label': 'DevTools',
|
|
19
|
-
'devtools overview label': '
|
|
19
|
+
'devtools overview label': 'Stats',
|
|
20
20
|
'debug label': 'Debug',
|
|
21
21
|
'debug app graph label': 'App Graph',
|
|
22
22
|
'settings show debug panel': 'Show Debug panel.',
|
package/src/types.ts
CHANGED
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
6
7
|
import { type Context, createContext } from 'react';
|
|
7
8
|
|
|
9
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
10
|
import type { TimerCallback, TimerOptions } from '@dxos/async';
|
|
9
11
|
|
|
12
|
+
import { meta } from './meta';
|
|
13
|
+
|
|
10
14
|
export type DebugContextType = {
|
|
11
15
|
running: boolean;
|
|
12
16
|
start: (cb: TimerCallback, options: TimerOptions) => void;
|
|
@@ -27,6 +31,10 @@ export const DebugSettingsSchema = Schema.mutable(
|
|
|
27
31
|
|
|
28
32
|
export interface DebugSettingsProps extends Schema.Schema.Type<typeof DebugSettingsSchema> {}
|
|
29
33
|
|
|
34
|
+
export namespace DebugCapabilities {
|
|
35
|
+
export const Settings = Capability.make<Atom.Writable<DebugSettingsProps>>(`${meta.id}/capability/settings`);
|
|
36
|
+
}
|
|
37
|
+
|
|
30
38
|
export namespace Devtools {
|
|
31
39
|
// TODO(wittjosiah): Cannot use slashes in ids until we have a router which decouples ids from url paths.
|
|
32
40
|
export const id = 'dxos.org.plugin.debug.devtools';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// src/components/DebugGraph.tsx
|
|
2
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { Tree } from "@dxos/devtools";
|
|
5
|
-
var DebugGraph = ({ graph, root }) => {
|
|
6
|
-
var _effect = _useSignals();
|
|
7
|
-
try {
|
|
8
|
-
return /* @__PURE__ */ React.createElement(Tree, {
|
|
9
|
-
data: graph.toJSON(root)
|
|
10
|
-
});
|
|
11
|
-
} finally {
|
|
12
|
-
_effect.f();
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
var DebugGraph_default = DebugGraph;
|
|
16
|
-
export {
|
|
17
|
-
DebugGraph,
|
|
18
|
-
DebugGraph_default as default
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=DebugGraph-EDOH6R2G.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/DebugGraph.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nimport { Tree } from '@dxos/devtools';\nimport { type Graph } from '@dxos/plugin-graph';\n\nexport const DebugGraph: FC<{ graph: Graph; root: string }> = ({ graph, root }) => {\n return <Tree data={graph.toJSON(root)} />;\n};\n\nexport default DebugGraph;\n"],
|
|
5
|
-
"mappings": ";;AAIA,OAAOA,WAAwB;AAE/B,SAASC,YAAY;AAGd,IAAMC,aAAiD,CAAC,EAAEC,OAAOC,KAAI,MAAE;;;AAC5E,WAAO,sBAAA,cAACC,MAAAA;MAAKC,MAAMH,MAAMI,OAAOH,IAAAA;;;;;AAClC;AAEA,IAAA,qBAAeF;",
|
|
6
|
-
"names": ["React", "Tree", "DebugGraph", "graph", "root", "Tree", "data", "toJSON"]
|
|
7
|
-
}
|