@dxos/plugin-debug 0.8.4-main.67995b8 → 0.8.4-main.69d29f4
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-6ZOCEREN.mjs → SpaceGenerator-H33AEFGC.mjs} +382 -211
- package/dist/lib/browser/SpaceGenerator-H33AEFGC.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 +36 -41
- 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-2N6CPSHR.mjs +757 -0
- package/dist/lib/browser/react-surface-2N6CPSHR.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 +9 -0
- package/dist/types/src/components/DebugGraph.d.ts.map +1 -0
- 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 +13 -4
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/draw-util.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/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 -3
- 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 +3 -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 +77 -69
- 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 +15 -0
- package/src/components/DebugObjectPanel.tsx +6 -8
- package/src/components/DebugSettings.tsx +109 -75
- package/src/components/DebugStatus.tsx +2 -2
- package/src/components/DevtoolsOverviewContainer.tsx +1 -1
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +28 -35
- package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +17 -15
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +24 -19
- package/src/components/SpaceGenerator/draw-util.ts +5 -5
- package/src/components/SpaceGenerator/presets.ts +324 -42
- package/src/components/Wireframe.tsx +6 -6
- package/src/components/index.ts +4 -1
- package/src/meta.ts +8 -7
- package/src/translations.ts +3 -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-6ZOCEREN.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-CHHHE5CF.mjs +0 -768
- package/dist/lib/browser/react-surface-CHHHE5CF.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/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/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/DebugApp/DebugApp.tsx +0 -84
- package/src/components/DebugApp/Tree.tsx +0 -103
- package/src/components/DebugApp/index.ts +0 -7
|
@@ -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 { Agent, EntityExtraction, 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, Type } from '@dxos/echo';
|
|
9
|
-
import {
|
|
10
|
+
import { DXN, Filter, Key, Obj, Query, type QueryAST, Ref, Tag, Type } from '@dxos/echo';
|
|
11
|
+
import { Trigger, serializeFunction } from '@dxos/functions';
|
|
10
12
|
import { invariant } from '@dxos/invariant';
|
|
13
|
+
import { gmail } 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,8 +23,8 @@ 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,
|
|
@@ -31,38 +36,233 @@ import {
|
|
|
31
36
|
pointsToRect,
|
|
32
37
|
rectToPoints,
|
|
33
38
|
} from '@dxos/react-ui-canvas-editor';
|
|
34
|
-
import {
|
|
39
|
+
import { View } from '@dxos/schema';
|
|
40
|
+
import { Message, Organization, Person, Project } from '@dxos/types';
|
|
41
|
+
import { range, trim } from '@dxos/util';
|
|
35
42
|
|
|
36
43
|
import { type ObjectGenerator } from './ObjectGenerator';
|
|
37
44
|
|
|
38
45
|
export enum PresetName {
|
|
46
|
+
DXOS_TEAM = 'dxos-team',
|
|
47
|
+
ORG_RESEARCH_PROJECT = 'org-research-project',
|
|
39
48
|
// EMAIL_TABLE = 'email-table',
|
|
40
49
|
GPT_QUEUE = 'webhook-gpt-queue',
|
|
41
50
|
CHAT_GPT = 'chat-gpt-text',
|
|
42
51
|
// EMAIL_WITH_SUMMARY = 'email-gptSummary-table',
|
|
43
52
|
OBJECT_CHANGE_QUEUE = 'objectChange-queue',
|
|
44
|
-
FOREX_FUNCTION_CALL = 'forex-function-call',
|
|
45
53
|
TIMER_TICK_QUEUE = 'timerTick-queue',
|
|
54
|
+
FOREX_FUNCTION_CALL = 'forex-function-call',
|
|
46
55
|
DISCORD_MESSAGES = 'discord-messages',
|
|
47
56
|
// KANBAN_QUEUE = 'kanban-queue',
|
|
48
57
|
}
|
|
49
58
|
|
|
50
59
|
export const generator = () => ({
|
|
51
|
-
schemas: [CanvasBoardType,
|
|
60
|
+
schemas: [CanvasBoardType, Trigger.Trigger] as any[],
|
|
52
61
|
types: Object.values(PresetName).map((name) => ({ typename: name })),
|
|
53
62
|
items: [
|
|
63
|
+
[
|
|
64
|
+
PresetName.DXOS_TEAM,
|
|
65
|
+
async (space, n, cb) => {
|
|
66
|
+
const objects = range(n, () => {
|
|
67
|
+
const org = space.db.add(
|
|
68
|
+
Obj.make(Organization.Organization, {
|
|
69
|
+
name: 'DXOS',
|
|
70
|
+
website: 'https://dxos.org',
|
|
71
|
+
}),
|
|
72
|
+
);
|
|
73
|
+
const doc = space.db.add(
|
|
74
|
+
Markdown.make({
|
|
75
|
+
name: 'DXOS Research',
|
|
76
|
+
content: 'DXOS builds Composer, an open-source AI-powered malleable application.',
|
|
77
|
+
}),
|
|
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] }));
|
|
95
|
+
space.db.add(
|
|
96
|
+
Obj.make(Person.Person, {
|
|
97
|
+
fullName: 'Josiah',
|
|
98
|
+
organization: Ref.make(org),
|
|
99
|
+
}),
|
|
100
|
+
);
|
|
101
|
+
space.db.add(
|
|
102
|
+
Obj.make(Person.Person, {
|
|
103
|
+
fullName: 'Dima',
|
|
104
|
+
organization: Ref.make(org),
|
|
105
|
+
}),
|
|
106
|
+
);
|
|
107
|
+
space.db.add(
|
|
108
|
+
Obj.make(Person.Person, {
|
|
109
|
+
fullName: 'Mykola',
|
|
110
|
+
organization: Ref.make(org),
|
|
111
|
+
}),
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
return doc;
|
|
115
|
+
});
|
|
116
|
+
cb?.(objects);
|
|
117
|
+
return objects;
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
[
|
|
121
|
+
PresetName.ORG_RESEARCH_PROJECT,
|
|
122
|
+
async (space, n, cb) => {
|
|
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();
|
|
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(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
|
+
);
|
|
197
|
+
|
|
198
|
+
const mailboxView = View.make({
|
|
199
|
+
query: Query.select(
|
|
200
|
+
Filter.type(Message.Message, {
|
|
201
|
+
properties: { labels: Filter.contains('investor') },
|
|
202
|
+
}),
|
|
203
|
+
).options({
|
|
204
|
+
queues: [mailbox.queue.dxn.toString()],
|
|
205
|
+
}),
|
|
206
|
+
jsonSchema: Type.toJsonSchema(Message.Message),
|
|
207
|
+
});
|
|
208
|
+
const contactsView = View.make({
|
|
209
|
+
query: contactsQuery,
|
|
210
|
+
jsonSchema: Type.toJsonSchema(Person.Person),
|
|
211
|
+
});
|
|
212
|
+
const organizationsView = View.make({
|
|
213
|
+
query: organizationsQuery,
|
|
214
|
+
jsonSchema: Type.toJsonSchema(Organization.Organization),
|
|
215
|
+
});
|
|
216
|
+
const notesView = View.make({
|
|
217
|
+
query: notesQuery,
|
|
218
|
+
jsonSchema: Type.toJsonSchema(Markdown.Document),
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
return space.db.add(
|
|
222
|
+
Project.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);
|
|
@@ -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);
|
|
@@ -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,13 +760,16 @@ 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
774
|
templateComputeNode.inputSchema = Type.toJsonSchema(Schema.Struct({ type: Schema.String, changeId: Schema.String }));
|
|
506
775
|
attachTrigger(functionTrigger, computeModel);
|
|
@@ -538,17 +807,27 @@ const setupQueue = (
|
|
|
538
807
|
return { queue, queueId };
|
|
539
808
|
};
|
|
540
809
|
|
|
541
|
-
const attachTrigger = (functionTrigger:
|
|
810
|
+
const attachTrigger = (functionTrigger: Trigger.Trigger | undefined, computeModel: ComputeGraphModel) => {
|
|
542
811
|
invariant(functionTrigger);
|
|
543
|
-
functionTrigger.function = Ref.make(computeModel.root);
|
|
544
812
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
|
|
545
|
-
functionTrigger
|
|
813
|
+
Obj.change(functionTrigger, (t) => {
|
|
814
|
+
t.function = Ref.make(computeModel.root);
|
|
815
|
+
t.inputNodeId = inputNode.id;
|
|
816
|
+
});
|
|
546
817
|
};
|
|
547
818
|
|
|
548
|
-
type RawPositionInput = {
|
|
819
|
+
type RawPositionInput = {
|
|
820
|
+
centerX: number;
|
|
821
|
+
centerY: number;
|
|
822
|
+
width: number;
|
|
823
|
+
height: number;
|
|
824
|
+
};
|
|
549
825
|
|
|
550
826
|
const rawPosition = (args: RawPositionInput) => {
|
|
551
|
-
return {
|
|
827
|
+
return {
|
|
828
|
+
center: { x: args.centerX, y: args.centerY },
|
|
829
|
+
size: { width: args.width, height: args.height },
|
|
830
|
+
};
|
|
552
831
|
};
|
|
553
832
|
|
|
554
833
|
const position = (rect: { x: number; y: number; width?: number; height?: number }) => {
|
|
@@ -556,7 +835,10 @@ const position = (rect: { x: number; y: number; width?: number; height?: number
|
|
|
556
835
|
const [center, size] = rectToPoints({ width: 0, height: 0, ...rect });
|
|
557
836
|
const { x, y, width, height } = pointsToRect([pointMultiply(center, snap), pointMultiply(size, snap)]);
|
|
558
837
|
if (width && height) {
|
|
559
|
-
return {
|
|
838
|
+
return {
|
|
839
|
+
center: { x, y },
|
|
840
|
+
size: width && height ? { width, height } : undefined,
|
|
841
|
+
};
|
|
560
842
|
} else {
|
|
561
843
|
return { center: { x, y } };
|
|
562
844
|
}
|
|
@@ -5,23 +5,23 @@
|
|
|
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();
|
|
24
|
+
|
|
25
25
|
return (
|
|
26
26
|
<div ref={ref} className={mx('relative grow min-bs-96', classNames)} {...attentionAttrs}>
|
|
27
27
|
<div className='absolute inset-2 flex flex-col gap-2 overflow-hidden font-mono'>
|
|
@@ -30,7 +30,7 @@ export const Wireframe = ({ classNames, label, object }: WireframeProps) => {
|
|
|
30
30
|
<div>{`[${width}x${height}]`}</div>
|
|
31
31
|
</div>
|
|
32
32
|
{object && (
|
|
33
|
-
<SyntaxHighlighter language='json' classNames='
|
|
33
|
+
<SyntaxHighlighter language='json' classNames='text-xs opacity-75 rounded'>
|
|
34
34
|
{JSON.stringify(object, undefined, 2)}
|
|
35
35
|
</SyntaxHighlighter>
|
|
36
36
|
)}
|
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
|
@@ -11,12 +11,14 @@ export const translations = [
|
|
|
11
11
|
'en-US': {
|
|
12
12
|
[meta.id]: {
|
|
13
13
|
'plugin name': 'Debug',
|
|
14
|
+
'settings title': 'Debug settings',
|
|
14
15
|
'mutation count': 'Number of mutations',
|
|
15
16
|
'mutation period': 'Mutation period',
|
|
16
17
|
'open devtools label': 'Open DevTools',
|
|
17
18
|
'devtools label': 'DevTools',
|
|
18
|
-
'devtools overview label': '
|
|
19
|
+
'devtools overview label': 'Stats',
|
|
19
20
|
'debug label': 'Debug',
|
|
21
|
+
'debug app graph label': 'App Graph',
|
|
20
22
|
'settings show debug panel': 'Show Debug panel.',
|
|
21
23
|
'settings show devtools panel': 'Show DevTools panel.',
|
|
22
24
|
'settings wireframe': 'Show wireframes.',
|
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';
|