@dxos/plugin-debug 0.8.4-main.1f223c7 → 0.8.4-main.2244d791bb
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-2C6XMJ3L.mjs +19 -0
- package/dist/lib/browser/DevtoolsOverviewContainer-2C6XMJ3L.mjs.map +7 -0
- package/dist/lib/browser/{SpaceGenerator-SRCIEELZ.mjs → SpaceGenerator-B4A7J26E.mjs} +312 -261
- package/dist/lib/browser/SpaceGenerator-B4A7J26E.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-DEBTVBQG.mjs +599 -0
- package/dist/lib/browser/app-graph-builder-DEBTVBQG.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 -43
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-I3USIAF6.mjs +17 -0
- package/dist/lib/browser/react-context-I3USIAF6.mjs.map +7 -0
- package/dist/lib/browser/react-surface-ADOU5663.mjs +758 -0
- package/dist/lib/browser/react-surface-ADOU5663.mjs.map +7 -0
- package/dist/lib/browser/settings-SLTQJJNF.mjs +32 -0
- package/dist/lib/browser/settings-SLTQJJNF.mjs.map +7 -0
- package/dist/types/src/DebugPlugin.d.ts +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 +6 -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 +78 -71
- package/src/DebugPlugin.tsx +18 -33
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +421 -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 +411 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +31 -0
- package/src/components/DebugGraph.tsx +4 -3
- package/src/components/DebugObjectPanel.tsx +6 -9
- package/src/components/DebugSettings.tsx +61 -35
- package/src/components/DebugStatus.tsx +2 -2
- package/src/components/DevtoolsOverviewContainer.tsx +2 -2
- 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 +35 -31
- package/src/components/SpaceGenerator/draw-util.ts +2 -2
- package/src/components/SpaceGenerator/presets.ts +264 -89
- 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 { AgentFunctions, EntityExtractionFunctions, 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, type QueryAST, Ref, Tag, Type } from '@dxos/echo';
|
|
11
|
+
import { Trigger, serializeFunction } from '@dxos/functions';
|
|
11
12
|
import { invariant } from '@dxos/invariant';
|
|
13
|
+
import { GmailFunctions } 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';
|
|
@@ -27,15 +29,10 @@ import {
|
|
|
27
29
|
createText,
|
|
28
30
|
createTrigger,
|
|
29
31
|
} from '@dxos/react-ui-canvas-compute';
|
|
30
|
-
import {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
pointsToRect,
|
|
35
|
-
rectToPoints,
|
|
36
|
-
} from '@dxos/react-ui-canvas-editor';
|
|
37
|
-
import { DataType, createView } from '@dxos/schema';
|
|
38
|
-
import { range } from '@dxos/util';
|
|
32
|
+
import { CanvasBoard, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from '@dxos/react-ui-canvas-editor';
|
|
33
|
+
import { View } from '@dxos/schema';
|
|
34
|
+
import { Message, Organization, Person, Pipeline } from '@dxos/types';
|
|
35
|
+
import { range, trim } from '@dxos/util';
|
|
39
36
|
|
|
40
37
|
import { type ObjectGenerator } from './ObjectGenerator';
|
|
41
38
|
|
|
@@ -47,43 +44,66 @@ export enum PresetName {
|
|
|
47
44
|
CHAT_GPT = 'chat-gpt-text',
|
|
48
45
|
// EMAIL_WITH_SUMMARY = 'email-gptSummary-table',
|
|
49
46
|
OBJECT_CHANGE_QUEUE = 'objectChange-queue',
|
|
50
|
-
FOREX_FUNCTION_CALL = 'forex-function-call',
|
|
51
47
|
TIMER_TICK_QUEUE = 'timerTick-queue',
|
|
48
|
+
FOREX_FUNCTION_CALL = 'forex-function-call',
|
|
52
49
|
DISCORD_MESSAGES = 'discord-messages',
|
|
53
50
|
// KANBAN_QUEUE = 'kanban-queue',
|
|
54
51
|
}
|
|
55
52
|
|
|
56
53
|
export const generator = () => ({
|
|
57
|
-
schemas: [
|
|
54
|
+
schemas: [CanvasBoard.CanvasBoard, Trigger.Trigger] as any[],
|
|
58
55
|
types: Object.values(PresetName).map((name) => ({ typename: name })),
|
|
59
56
|
items: [
|
|
60
57
|
[
|
|
61
58
|
PresetName.DXOS_TEAM,
|
|
62
59
|
async (space, n, cb) => {
|
|
63
60
|
const objects = range(n, () => {
|
|
64
|
-
const org = space.db.add(
|
|
65
|
-
|
|
61
|
+
const org = space.db.add(
|
|
62
|
+
Obj.make(Organization.Organization, {
|
|
63
|
+
name: 'DXOS',
|
|
64
|
+
website: 'https://dxos.org',
|
|
65
|
+
}),
|
|
66
|
+
);
|
|
66
67
|
const doc = space.db.add(
|
|
67
|
-
Markdown.
|
|
68
|
+
Markdown.make({
|
|
68
69
|
name: 'DXOS Research',
|
|
69
70
|
content: 'DXOS builds Composer, an open-source AI-powered malleable application.',
|
|
70
71
|
}),
|
|
71
72
|
);
|
|
73
|
+
|
|
74
|
+
const tag = space.db.add(Tag.make({ label: 'Investor' }));
|
|
75
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
76
|
+
Obj.change(doc, (d) => {
|
|
77
|
+
Obj.getMeta(d).tags = [tagDxn];
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// space.db.add(
|
|
81
|
+
// Relation.make(HasSubject, {
|
|
82
|
+
// [Relation.Source]: doc,
|
|
83
|
+
// [Relation.Target]: org,
|
|
84
|
+
// completedAt: new Date().toISOString(),
|
|
85
|
+
// }),
|
|
86
|
+
// );
|
|
87
|
+
|
|
88
|
+
space.db.add(Obj.make(Person.Person, { fullName: 'Rich', organization: Ref.make(org) }, { tags: [tagDxn] }));
|
|
72
89
|
space.db.add(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
completedAt: new Date().toISOString(),
|
|
90
|
+
Obj.make(Person.Person, {
|
|
91
|
+
fullName: 'Josiah',
|
|
92
|
+
organization: Ref.make(org),
|
|
77
93
|
}),
|
|
78
94
|
);
|
|
79
|
-
|
|
80
95
|
space.db.add(
|
|
81
|
-
Obj.make(
|
|
96
|
+
Obj.make(Person.Person, {
|
|
97
|
+
fullName: 'Dima',
|
|
98
|
+
organization: Ref.make(org),
|
|
99
|
+
}),
|
|
100
|
+
);
|
|
101
|
+
space.db.add(
|
|
102
|
+
Obj.make(Person.Person, {
|
|
103
|
+
fullName: 'Mykola',
|
|
104
|
+
organization: Ref.make(org),
|
|
105
|
+
}),
|
|
82
106
|
);
|
|
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
107
|
|
|
88
108
|
return doc;
|
|
89
109
|
});
|
|
@@ -95,59 +115,132 @@ export const generator = () => ({
|
|
|
95
115
|
PresetName.ORG_RESEARCH_PROJECT,
|
|
96
116
|
async (space, n, cb) => {
|
|
97
117
|
const mailbox = await space.db.query(Filter.type(Mailbox.Mailbox)).first();
|
|
118
|
+
const tag = await space.db.query(Filter.type(Tag.Tag, { label: 'Investor' })).first();
|
|
119
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
98
120
|
|
|
99
121
|
const objects = range(n, () => {
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
122
|
+
const contactsQuery = Query.select(Filter.type(Person.Person)).select(Filter.tag(tagDxn));
|
|
123
|
+
const organizationsQuery = Query.select(Filter.type(Organization.Organization)).select(Filter.tag(tagDxn));
|
|
124
|
+
const notesQuery = Query.select(Filter.type(Markdown.Document)).select(Filter.tag(tagDxn));
|
|
125
|
+
|
|
126
|
+
space.db.add(
|
|
127
|
+
Trigger.make({
|
|
128
|
+
enabled: true,
|
|
129
|
+
spec: {
|
|
130
|
+
kind: 'timer',
|
|
131
|
+
cron: '* * * * *', // Every minute.
|
|
132
|
+
},
|
|
133
|
+
function: Ref.make(serializeFunction(GmailFunctions.Sync)),
|
|
134
|
+
input: {
|
|
135
|
+
mailbox: Ref.make(mailbox),
|
|
136
|
+
},
|
|
137
|
+
}),
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
space.db.add(
|
|
141
|
+
Trigger.make({
|
|
142
|
+
enabled: true,
|
|
143
|
+
// TODO(wittjosiah): Queue trigger doesn't support matching query of the column.
|
|
144
|
+
spec: {
|
|
145
|
+
kind: 'queue',
|
|
146
|
+
queue: mailbox.queue.dxn.toString(),
|
|
147
|
+
},
|
|
148
|
+
function: Ref.make(serializeFunction(EntityExtractionFunctions.Extract)),
|
|
149
|
+
input: {
|
|
150
|
+
source: '{{event.item}}',
|
|
151
|
+
},
|
|
152
|
+
}),
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
const researchPrompt = space.db.add(
|
|
156
|
+
Prompt.make({
|
|
157
|
+
name: 'Research',
|
|
158
|
+
description: 'Research organization',
|
|
159
|
+
input: Schema.Struct({
|
|
160
|
+
org: Schema.Any,
|
|
161
|
+
}),
|
|
162
|
+
output: Schema.Any,
|
|
163
|
+
|
|
164
|
+
// TODO(dmaretskyi): This mocks research (returns pre-baked result), the actual research might take compute minutes.
|
|
165
|
+
// Remove the mock prompt to do the actual research.
|
|
166
|
+
instructions: trim`
|
|
167
|
+
Research the organization provided as input.
|
|
168
|
+
Create a research note for it at the end.
|
|
169
|
+
NOTE: Do mocked reseach (set mockSearch to true).
|
|
170
|
+
`,
|
|
171
|
+
blueprints: [Ref.make(ResearchBlueprint.make())],
|
|
172
|
+
}),
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
space.db.add(
|
|
176
|
+
Trigger.make({
|
|
177
|
+
enabled: true,
|
|
178
|
+
spec: {
|
|
179
|
+
kind: 'subscription',
|
|
180
|
+
query: {
|
|
181
|
+
ast: organizationsQuery.ast,
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
function: Ref.make(serializeFunction(AgentFunctions.Prompt)),
|
|
185
|
+
input: {
|
|
186
|
+
prompt: Ref.make(researchPrompt),
|
|
187
|
+
input: '{{event.subject}}',
|
|
188
|
+
},
|
|
189
|
+
}),
|
|
190
|
+
);
|
|
114
191
|
|
|
115
|
-
const mailboxView =
|
|
116
|
-
name: 'Mailbox',
|
|
192
|
+
const mailboxView = View.make({
|
|
117
193
|
query: Query.select(
|
|
118
|
-
Filter.type(
|
|
194
|
+
Filter.type(Message.Message, {
|
|
195
|
+
properties: { labels: Filter.contains('investor') },
|
|
196
|
+
}),
|
|
119
197
|
).options({
|
|
120
198
|
queues: [mailbox.queue.dxn.toString()],
|
|
121
199
|
}),
|
|
122
|
-
jsonSchema: Type.toJsonSchema(
|
|
123
|
-
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
200
|
+
jsonSchema: Type.toJsonSchema(Message.Message),
|
|
124
201
|
});
|
|
125
|
-
const contactsView =
|
|
126
|
-
name: 'Contacts',
|
|
202
|
+
const contactsView = View.make({
|
|
127
203
|
query: contactsQuery,
|
|
128
|
-
jsonSchema: Type.toJsonSchema(
|
|
129
|
-
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
204
|
+
jsonSchema: Type.toJsonSchema(Person.Person),
|
|
130
205
|
});
|
|
131
|
-
const organizationsView =
|
|
132
|
-
name: 'Organizations',
|
|
206
|
+
const organizationsView = View.make({
|
|
133
207
|
query: organizationsQuery,
|
|
134
|
-
jsonSchema: Type.toJsonSchema(
|
|
135
|
-
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
208
|
+
jsonSchema: Type.toJsonSchema(Organization.Organization),
|
|
136
209
|
});
|
|
137
|
-
const notesView =
|
|
138
|
-
name: 'Notes',
|
|
210
|
+
const notesView = View.make({
|
|
139
211
|
query: notesQuery,
|
|
140
212
|
jsonSchema: Type.toJsonSchema(Markdown.Document),
|
|
141
|
-
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
142
213
|
});
|
|
143
214
|
|
|
144
215
|
return space.db.add(
|
|
145
|
-
|
|
216
|
+
Pipeline.make({
|
|
146
217
|
name: 'Investor Research',
|
|
147
|
-
|
|
218
|
+
columns: [
|
|
219
|
+
{
|
|
220
|
+
name: 'Mailbox',
|
|
221
|
+
view: Ref.make(mailboxView),
|
|
222
|
+
order: [],
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: 'Contacts',
|
|
226
|
+
view: Ref.make(contactsView),
|
|
227
|
+
order: [],
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: 'Organizations',
|
|
231
|
+
view: Ref.make(organizationsView),
|
|
232
|
+
order: [],
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: 'Notes',
|
|
236
|
+
view: Ref.make(notesView),
|
|
237
|
+
order: [],
|
|
238
|
+
},
|
|
239
|
+
],
|
|
148
240
|
}),
|
|
149
241
|
);
|
|
150
242
|
});
|
|
243
|
+
|
|
151
244
|
cb?.(objects.flat());
|
|
152
245
|
return objects.flat();
|
|
153
246
|
},
|
|
@@ -158,7 +251,7 @@ export const generator = () => ({
|
|
|
158
251
|
const objects = range(n, () => {
|
|
159
252
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
160
253
|
|
|
161
|
-
let functionTrigger:
|
|
254
|
+
let functionTrigger: Trigger.Trigger | undefined;
|
|
162
255
|
canvasModel.builder.call((builder) => {
|
|
163
256
|
const gpt = canvasModel.createNode(createGpt(position({ x: 0, y: -14 })));
|
|
164
257
|
const triggerShape = createTrigger({
|
|
@@ -172,10 +265,24 @@ export const generator = () => ({
|
|
|
172
265
|
const append = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
|
|
173
266
|
|
|
174
267
|
builder
|
|
175
|
-
.createEdge({
|
|
268
|
+
.createEdge({
|
|
269
|
+
source: trigger.id,
|
|
270
|
+
target: gpt.id,
|
|
271
|
+
input: 'prompt',
|
|
272
|
+
output: 'bodyText',
|
|
273
|
+
})
|
|
176
274
|
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
177
|
-
.createEdge({
|
|
178
|
-
|
|
275
|
+
.createEdge({
|
|
276
|
+
source: queueId.id,
|
|
277
|
+
target: append.id,
|
|
278
|
+
input: 'id',
|
|
279
|
+
})
|
|
280
|
+
.createEdge({
|
|
281
|
+
source: gpt.id,
|
|
282
|
+
target: append.id,
|
|
283
|
+
output: 'messages',
|
|
284
|
+
input: 'items',
|
|
285
|
+
});
|
|
179
286
|
|
|
180
287
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
181
288
|
});
|
|
@@ -198,7 +305,10 @@ export const generator = () => ({
|
|
|
198
305
|
const { canvasModel, computeModel } = createQueueSinkPreset(
|
|
199
306
|
space,
|
|
200
307
|
'subscription',
|
|
201
|
-
(triggerSpec) =>
|
|
308
|
+
(triggerSpec) =>
|
|
309
|
+
(triggerSpec.query = {
|
|
310
|
+
ast: Query.select(Filter.typename('dxos.org/type/Chess')).ast as Obj.Mutable<QueryAST.Query>,
|
|
311
|
+
}),
|
|
202
312
|
'type',
|
|
203
313
|
);
|
|
204
314
|
return addToSpace(PresetName.OBJECT_CHANGE_QUEUE, space, canvasModel, computeModel);
|
|
@@ -310,8 +420,17 @@ export const generator = () => ({
|
|
|
310
420
|
builder
|
|
311
421
|
.createEdge({ source: chat.id, target: gpt.id, input: 'prompt' })
|
|
312
422
|
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
313
|
-
.createEdge({
|
|
314
|
-
|
|
423
|
+
.createEdge({
|
|
424
|
+
source: queueId.id,
|
|
425
|
+
target: append.id,
|
|
426
|
+
input: 'id',
|
|
427
|
+
})
|
|
428
|
+
.createEdge({
|
|
429
|
+
source: gpt.id,
|
|
430
|
+
target: append.id,
|
|
431
|
+
output: 'messages',
|
|
432
|
+
input: 'items',
|
|
433
|
+
});
|
|
315
434
|
});
|
|
316
435
|
|
|
317
436
|
const computeModel = createComputeGraph(canvasModel);
|
|
@@ -435,9 +554,21 @@ export const generator = () => ({
|
|
|
435
554
|
const view = canvasModel.createNode(createSurface(position({ x: 12, y: 0 })));
|
|
436
555
|
|
|
437
556
|
builder
|
|
438
|
-
.createEdge({
|
|
439
|
-
|
|
440
|
-
|
|
557
|
+
.createEdge({
|
|
558
|
+
source: sourceCurrency.id,
|
|
559
|
+
target: converter.id,
|
|
560
|
+
input: 'from',
|
|
561
|
+
})
|
|
562
|
+
.createEdge({
|
|
563
|
+
source: targetCurrency.id,
|
|
564
|
+
target: converter.id,
|
|
565
|
+
input: 'to',
|
|
566
|
+
})
|
|
567
|
+
.createEdge({
|
|
568
|
+
source: converter.id,
|
|
569
|
+
target: view.id,
|
|
570
|
+
output: 'rate',
|
|
571
|
+
});
|
|
441
572
|
});
|
|
442
573
|
|
|
443
574
|
const computeModel = createComputeGraph(canvasModel);
|
|
@@ -455,7 +586,7 @@ export const generator = () => ({
|
|
|
455
586
|
const objects = range(n, () => {
|
|
456
587
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
457
588
|
|
|
458
|
-
let functionTrigger:
|
|
589
|
+
let functionTrigger: Trigger.Trigger | undefined;
|
|
459
590
|
canvasModel.builder.call((builder) => {
|
|
460
591
|
const triggerShape = createTrigger({
|
|
461
592
|
spaceId: space.id,
|
|
@@ -465,7 +596,10 @@ export const generator = () => ({
|
|
|
465
596
|
const trigger = canvasModel.createNode(triggerShape);
|
|
466
597
|
// DXOS dev-null channel.
|
|
467
598
|
const channelId = canvasModel.createNode(
|
|
468
|
-
createConstant({
|
|
599
|
+
createConstant({
|
|
600
|
+
value: '1088569858767212554',
|
|
601
|
+
...position({ x: -10, y: 0 }),
|
|
602
|
+
}),
|
|
469
603
|
);
|
|
470
604
|
const queueId = canvasModel.createNode(
|
|
471
605
|
createConstant({
|
|
@@ -478,11 +612,31 @@ export const generator = () => ({
|
|
|
478
612
|
const queue = canvasModel.createNode(createQueue(position({ x: 0, y: 12 })));
|
|
479
613
|
|
|
480
614
|
builder
|
|
481
|
-
.createEdge({
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
615
|
+
.createEdge({
|
|
616
|
+
source: trigger.id,
|
|
617
|
+
target: converter.id,
|
|
618
|
+
input: 'tick',
|
|
619
|
+
})
|
|
620
|
+
.createEdge({
|
|
621
|
+
source: channelId.id,
|
|
622
|
+
target: converter.id,
|
|
623
|
+
input: 'channelId',
|
|
624
|
+
})
|
|
625
|
+
.createEdge({
|
|
626
|
+
source: queueId.id,
|
|
627
|
+
target: converter.id,
|
|
628
|
+
input: 'queueId',
|
|
629
|
+
})
|
|
630
|
+
.createEdge({
|
|
631
|
+
source: converter.id,
|
|
632
|
+
target: view.id,
|
|
633
|
+
output: 'newMessages',
|
|
634
|
+
})
|
|
635
|
+
.createEdge({
|
|
636
|
+
source: queueId.id,
|
|
637
|
+
target: queue.id,
|
|
638
|
+
input: 'input',
|
|
639
|
+
});
|
|
486
640
|
|
|
487
641
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
488
642
|
});
|
|
@@ -549,10 +703,10 @@ export const generator = () => ({
|
|
|
549
703
|
] as [PresetName, ObjectGenerator<any>][],
|
|
550
704
|
});
|
|
551
705
|
|
|
552
|
-
const createQueueSinkPreset = <SpecType extends
|
|
706
|
+
const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
553
707
|
space: Space,
|
|
554
708
|
triggerKind: SpecType,
|
|
555
|
-
initSpec: (spec: Extract<
|
|
709
|
+
initSpec: (spec: Obj.Mutable<Extract<Trigger.Spec, { kind: SpecType }>>) => void,
|
|
556
710
|
triggerOutputName: string,
|
|
557
711
|
) => {
|
|
558
712
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
@@ -564,7 +718,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
564
718
|
}),
|
|
565
719
|
);
|
|
566
720
|
|
|
567
|
-
let functionTrigger:
|
|
721
|
+
let functionTrigger: Trigger.Trigger | undefined;
|
|
568
722
|
canvasModel.builder.call((builder) => {
|
|
569
723
|
const triggerShape = createTrigger({
|
|
570
724
|
spaceId: space.id,
|
|
@@ -585,7 +739,12 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
585
739
|
builder
|
|
586
740
|
.createEdge({ source: queueId.id, target: append.id, input: 'id' })
|
|
587
741
|
.createEdge({ source: template.id, target: append.id, input: 'items' })
|
|
588
|
-
.createEdge({
|
|
742
|
+
.createEdge({
|
|
743
|
+
source: trigger.id,
|
|
744
|
+
target: template.id,
|
|
745
|
+
output: triggerOutputName,
|
|
746
|
+
input: 'type',
|
|
747
|
+
})
|
|
589
748
|
.createEdge({
|
|
590
749
|
source: random.id,
|
|
591
750
|
target: template.id,
|
|
@@ -595,13 +754,16 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
595
754
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
596
755
|
const triggerSpec = functionTrigger.spec;
|
|
597
756
|
invariant(triggerSpec && triggerSpec.kind === triggerKind, 'No trigger spec.');
|
|
598
|
-
|
|
757
|
+
Obj.change(functionTrigger, (ft) => {
|
|
758
|
+
initSpec(ft.spec as any);
|
|
759
|
+
});
|
|
599
760
|
});
|
|
600
761
|
|
|
601
762
|
const computeModel = createComputeGraph(canvasModel);
|
|
602
763
|
|
|
603
764
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
604
765
|
invariant(templateComputeNode, 'Template compute node was not created.');
|
|
766
|
+
// NOTE: These are plain object mutations during model construction, not ECHO object mutations.
|
|
605
767
|
templateComputeNode.value = ['{', ' "@type": "{{type}}",', ' "id": "@{{changeId}}"', '}'].join('\n');
|
|
606
768
|
templateComputeNode.inputSchema = Type.toJsonSchema(Schema.Struct({ type: Schema.String, changeId: Schema.String }));
|
|
607
769
|
attachTrigger(functionTrigger, computeModel);
|
|
@@ -611,7 +773,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
611
773
|
|
|
612
774
|
const addToSpace = (name: string, space: Space, canvas: CanvasGraphModel, compute: ComputeGraphModel) => {
|
|
613
775
|
return space.db.add(
|
|
614
|
-
Obj.make(
|
|
776
|
+
Obj.make(CanvasBoard.CanvasBoard, {
|
|
615
777
|
name,
|
|
616
778
|
computeGraph: Ref.make(compute.root),
|
|
617
779
|
layout: canvas.graph,
|
|
@@ -639,17 +801,27 @@ const setupQueue = (
|
|
|
639
801
|
return { queue, queueId };
|
|
640
802
|
};
|
|
641
803
|
|
|
642
|
-
const attachTrigger = (functionTrigger:
|
|
804
|
+
const attachTrigger = (functionTrigger: Trigger.Trigger | undefined, computeModel: ComputeGraphModel) => {
|
|
643
805
|
invariant(functionTrigger);
|
|
644
|
-
functionTrigger.function = Ref.make(computeModel.root);
|
|
645
806
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
|
|
646
|
-
functionTrigger
|
|
807
|
+
Obj.change(functionTrigger, (t) => {
|
|
808
|
+
t.function = Ref.make(computeModel.root);
|
|
809
|
+
t.inputNodeId = inputNode.id;
|
|
810
|
+
});
|
|
647
811
|
};
|
|
648
812
|
|
|
649
|
-
type RawPositionInput = {
|
|
813
|
+
type RawPositionInput = {
|
|
814
|
+
centerX: number;
|
|
815
|
+
centerY: number;
|
|
816
|
+
width: number;
|
|
817
|
+
height: number;
|
|
818
|
+
};
|
|
650
819
|
|
|
651
820
|
const rawPosition = (args: RawPositionInput) => {
|
|
652
|
-
return {
|
|
821
|
+
return {
|
|
822
|
+
center: { x: args.centerX, y: args.centerY },
|
|
823
|
+
size: { width: args.width, height: args.height },
|
|
824
|
+
};
|
|
653
825
|
};
|
|
654
826
|
|
|
655
827
|
const position = (rect: { x: number; y: number; width?: number; height?: number }) => {
|
|
@@ -657,7 +829,10 @@ const position = (rect: { x: number; y: number; width?: number; height?: number
|
|
|
657
829
|
const [center, size] = rectToPoints({ width: 0, height: 0, ...rect });
|
|
658
830
|
const { x, y, width, height } = pointsToRect([pointMultiply(center, snap), pointMultiply(size, snap)]);
|
|
659
831
|
if (width && height) {
|
|
660
|
-
return {
|
|
832
|
+
return {
|
|
833
|
+
center: { x, y },
|
|
834
|
+
size: width && height ? { width, height } : undefined,
|
|
835
|
+
};
|
|
661
836
|
} else {
|
|
662
837
|
return { center: { x, y } };
|
|
663
838
|
}
|
|
@@ -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
|