@dxos/plugin-debug 0.8.4-main.2e9d522 → 0.8.4-main.3eb6e50203
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-AG3XGNMV.mjs → SpaceGenerator-W3LJORYT.mjs} +388 -219
- package/dist/lib/browser/SpaceGenerator-W3LJORYT.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 +37 -41
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-I3USIAF6.mjs +17 -0
- package/dist/lib/browser/react-context-I3USIAF6.mjs.map +7 -0
- package/dist/lib/browser/react-surface-FMVC5GPV.mjs +758 -0
- package/dist/lib/browser/react-surface-FMVC5GPV.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 +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 +79 -69
- 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 +15 -0
- package/src/components/DebugObjectPanel.tsx +6 -9
- package/src/components/DebugSettings.tsx +109 -75
- package/src/components/DebugStatus.tsx +2 -2
- package/src/components/DevtoolsOverviewContainer.tsx +2 -2
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +31 -38
- package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +17 -15
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +39 -35
- package/src/components/SpaceGenerator/draw-util.ts +5 -5
- package/src/components/SpaceGenerator/presets.ts +326 -50
- 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-AG3XGNMV.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-SQXFD2BL.mjs +0 -597
- package/dist/lib/browser/app-graph-builder-SQXFD2BL.mjs.map +0 -7
- package/dist/lib/browser/chunk-5XPIRNQS.mjs +0 -18
- package/dist/lib/browser/chunk-5XPIRNQS.mjs.map +0 -7
- package/dist/lib/browser/chunk-AJA6RYN3.mjs.map +0 -7
- package/dist/lib/browser/react-context-NVAGLAJD.mjs +0 -16
- package/dist/lib/browser/react-context-NVAGLAJD.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3GD2OWCA.mjs +0 -768
- package/dist/lib/browser/react-surface-3GD2OWCA.mjs.map +0 -7
- package/dist/lib/browser/settings-LSSWLM5I.mjs +0 -22
- package/dist/lib/browser/settings-LSSWLM5I.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-context.d.ts +0 -8
- package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/components/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
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
// TODO(burdon): workerize-loader dep.
|
|
6
|
-
import {
|
|
6
|
+
import { type Edge, Graph, type PlainObject } from '@antv/graphlib';
|
|
7
7
|
import {
|
|
8
|
-
type Layout,
|
|
9
8
|
D3ForceLayout,
|
|
10
9
|
type D3ForceLayoutOptions,
|
|
11
10
|
GridLayout,
|
|
12
11
|
type GridLayoutOptions,
|
|
12
|
+
type Layout,
|
|
13
13
|
RadialLayout,
|
|
14
14
|
type RadialLayoutOptions,
|
|
15
15
|
} from '@antv/layout';
|
|
16
|
-
import {
|
|
16
|
+
import { type Editor, type SerializedStore, type TLRecord, createBindingId, createShapeId } from '@tldraw/tldraw';
|
|
17
17
|
|
|
18
18
|
import { faker } from '@dxos/random';
|
|
19
|
-
import {
|
|
19
|
+
import { isTruthy, range } from '@dxos/util';
|
|
20
20
|
|
|
21
21
|
// TODO(burdon): Graph layout:
|
|
22
22
|
// - https://www.npmjs.com/package/@antv/layout (uses d3)
|
|
@@ -67,7 +67,7 @@ export const generateGraph = (): Graph<PlainObject, PlainObject> => {
|
|
|
67
67
|
}
|
|
68
68
|
return target;
|
|
69
69
|
})
|
|
70
|
-
.filter(
|
|
70
|
+
.filter(isTruthy);
|
|
71
71
|
|
|
72
72
|
for (const target of targets) {
|
|
73
73
|
traverse(target);
|
|
@@ -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,51 +23,240 @@ import {
|
|
|
18
23
|
createFunction,
|
|
19
24
|
createGpt,
|
|
20
25
|
createQueue,
|
|
21
|
-
createSurface,
|
|
22
26
|
createRandom,
|
|
27
|
+
createSurface,
|
|
23
28
|
createTemplate,
|
|
24
29
|
createText,
|
|
25
30
|
createTrigger,
|
|
26
31
|
} from '@dxos/react-ui-canvas-compute';
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
pointsToRect,
|
|
32
|
-
rectToPoints,
|
|
33
|
-
} from '@dxos/react-ui-canvas-editor';
|
|
34
|
-
import { range } from '@dxos/util';
|
|
32
|
+
import { CanvasBoard, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from '@dxos/react-ui-canvas-editor';
|
|
33
|
+
import { View } from '@dxos/schema';
|
|
34
|
+
import { Message, Organization, Person, Pipeline } from '@dxos/types';
|
|
35
|
+
import { range, trim } from '@dxos/util';
|
|
35
36
|
|
|
36
37
|
import { type ObjectGenerator } from './ObjectGenerator';
|
|
37
38
|
|
|
38
39
|
export enum PresetName {
|
|
40
|
+
DXOS_TEAM = 'dxos-team',
|
|
41
|
+
ORG_RESEARCH_PROJECT = 'org-research-project',
|
|
39
42
|
// EMAIL_TABLE = 'email-table',
|
|
40
43
|
GPT_QUEUE = 'webhook-gpt-queue',
|
|
41
44
|
CHAT_GPT = 'chat-gpt-text',
|
|
42
45
|
// EMAIL_WITH_SUMMARY = 'email-gptSummary-table',
|
|
43
46
|
OBJECT_CHANGE_QUEUE = 'objectChange-queue',
|
|
44
|
-
FOREX_FUNCTION_CALL = 'forex-function-call',
|
|
45
47
|
TIMER_TICK_QUEUE = 'timerTick-queue',
|
|
48
|
+
FOREX_FUNCTION_CALL = 'forex-function-call',
|
|
46
49
|
DISCORD_MESSAGES = 'discord-messages',
|
|
47
50
|
// KANBAN_QUEUE = 'kanban-queue',
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
export const generator = () => ({
|
|
51
|
-
schemas: [
|
|
54
|
+
schemas: [CanvasBoard.CanvasBoard, Trigger.Trigger] as any[],
|
|
52
55
|
types: Object.values(PresetName).map((name) => ({ typename: name })),
|
|
53
56
|
items: [
|
|
57
|
+
[
|
|
58
|
+
PresetName.DXOS_TEAM,
|
|
59
|
+
async (space, n, cb) => {
|
|
60
|
+
const objects = range(n, () => {
|
|
61
|
+
const org = space.db.add(
|
|
62
|
+
Obj.make(Organization.Organization, {
|
|
63
|
+
name: 'DXOS',
|
|
64
|
+
website: 'https://dxos.org',
|
|
65
|
+
}),
|
|
66
|
+
);
|
|
67
|
+
const doc = space.db.add(
|
|
68
|
+
Markdown.make({
|
|
69
|
+
name: 'DXOS Research',
|
|
70
|
+
content: 'DXOS builds Composer, an open-source AI-powered malleable application.',
|
|
71
|
+
}),
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const tag = space.db.add(Tag.make({ label: 'Investor' }));
|
|
75
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
76
|
+
Obj.change(doc, (d) => {
|
|
77
|
+
Obj.getMeta(d).tags = [tagDxn];
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// space.db.add(
|
|
81
|
+
// Relation.make(HasSubject, {
|
|
82
|
+
// [Relation.Source]: doc,
|
|
83
|
+
// [Relation.Target]: org,
|
|
84
|
+
// completedAt: new Date().toISOString(),
|
|
85
|
+
// }),
|
|
86
|
+
// );
|
|
87
|
+
|
|
88
|
+
space.db.add(Obj.make(Person.Person, { fullName: 'Rich', organization: Ref.make(org) }, { tags: [tagDxn] }));
|
|
89
|
+
space.db.add(
|
|
90
|
+
Obj.make(Person.Person, {
|
|
91
|
+
fullName: 'Josiah',
|
|
92
|
+
organization: Ref.make(org),
|
|
93
|
+
}),
|
|
94
|
+
);
|
|
95
|
+
space.db.add(
|
|
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
|
+
}),
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
return doc;
|
|
109
|
+
});
|
|
110
|
+
cb?.(objects);
|
|
111
|
+
return objects;
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
[
|
|
115
|
+
PresetName.ORG_RESEARCH_PROJECT,
|
|
116
|
+
async (space, n, cb) => {
|
|
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();
|
|
120
|
+
|
|
121
|
+
const objects = range(n, () => {
|
|
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(gmail.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(EntityExtraction.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)],
|
|
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(Agent.prompt)),
|
|
185
|
+
input: {
|
|
186
|
+
prompt: Ref.make(researchPrompt),
|
|
187
|
+
input: '{{event.subject}}',
|
|
188
|
+
},
|
|
189
|
+
}),
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
const mailboxView = View.make({
|
|
193
|
+
query: Query.select(
|
|
194
|
+
Filter.type(Message.Message, {
|
|
195
|
+
properties: { labels: Filter.contains('investor') },
|
|
196
|
+
}),
|
|
197
|
+
).options({
|
|
198
|
+
queues: [mailbox.queue.dxn.toString()],
|
|
199
|
+
}),
|
|
200
|
+
jsonSchema: Type.toJsonSchema(Message.Message),
|
|
201
|
+
});
|
|
202
|
+
const contactsView = View.make({
|
|
203
|
+
query: contactsQuery,
|
|
204
|
+
jsonSchema: Type.toJsonSchema(Person.Person),
|
|
205
|
+
});
|
|
206
|
+
const organizationsView = View.make({
|
|
207
|
+
query: organizationsQuery,
|
|
208
|
+
jsonSchema: Type.toJsonSchema(Organization.Organization),
|
|
209
|
+
});
|
|
210
|
+
const notesView = View.make({
|
|
211
|
+
query: notesQuery,
|
|
212
|
+
jsonSchema: Type.toJsonSchema(Markdown.Document),
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
return space.db.add(
|
|
216
|
+
Pipeline.make({
|
|
217
|
+
name: 'Investor Research',
|
|
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
|
+
],
|
|
240
|
+
}),
|
|
241
|
+
);
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
cb?.(objects.flat());
|
|
245
|
+
return objects.flat();
|
|
246
|
+
},
|
|
247
|
+
],
|
|
54
248
|
[
|
|
55
249
|
PresetName.GPT_QUEUE,
|
|
56
250
|
async (space, n, cb) => {
|
|
57
251
|
const objects = range(n, () => {
|
|
58
252
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
59
253
|
|
|
60
|
-
let functionTrigger:
|
|
254
|
+
let functionTrigger: Trigger.Trigger | undefined;
|
|
61
255
|
canvasModel.builder.call((builder) => {
|
|
62
256
|
const gpt = canvasModel.createNode(createGpt(position({ x: 0, y: -14 })));
|
|
63
257
|
const triggerShape = createTrigger({
|
|
64
258
|
spaceId: space.id,
|
|
65
|
-
triggerKind:
|
|
259
|
+
triggerKind: 'webhook',
|
|
66
260
|
...position({ x: -18, y: -2 }),
|
|
67
261
|
});
|
|
68
262
|
const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -71,10 +265,24 @@ export const generator = () => ({
|
|
|
71
265
|
const append = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
|
|
72
266
|
|
|
73
267
|
builder
|
|
74
|
-
.createEdge({
|
|
268
|
+
.createEdge({
|
|
269
|
+
source: trigger.id,
|
|
270
|
+
target: gpt.id,
|
|
271
|
+
input: 'prompt',
|
|
272
|
+
output: 'bodyText',
|
|
273
|
+
})
|
|
75
274
|
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
76
|
-
.createEdge({
|
|
77
|
-
|
|
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
|
+
});
|
|
78
286
|
|
|
79
287
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
80
288
|
});
|
|
@@ -96,8 +304,11 @@ export const generator = () => ({
|
|
|
96
304
|
const objects = range(n, () => {
|
|
97
305
|
const { canvasModel, computeModel } = createQueueSinkPreset(
|
|
98
306
|
space,
|
|
99
|
-
|
|
100
|
-
(triggerSpec) =>
|
|
307
|
+
'subscription',
|
|
308
|
+
(triggerSpec) =>
|
|
309
|
+
(triggerSpec.query = {
|
|
310
|
+
ast: Query.select(Filter.typename('dxos.org/type/Chess')).ast as Obj.Mutable<QueryAST.Query>,
|
|
311
|
+
}),
|
|
101
312
|
'type',
|
|
102
313
|
);
|
|
103
314
|
return addToSpace(PresetName.OBJECT_CHANGE_QUEUE, space, canvasModel, computeModel);
|
|
@@ -113,7 +324,7 @@ export const generator = () => ({
|
|
|
113
324
|
const objects = range(n, () => {
|
|
114
325
|
const { canvasModel, computeModel } = createQueueSinkPreset(
|
|
115
326
|
space,
|
|
116
|
-
|
|
327
|
+
'timer',
|
|
117
328
|
(triggerSpec) => (triggerSpec.cron = '*/5 * * * * *'),
|
|
118
329
|
'result',
|
|
119
330
|
);
|
|
@@ -147,7 +358,7 @@ export const generator = () => ({
|
|
|
147
358
|
// canvasModel.builder.call((builder) => {
|
|
148
359
|
// const triggerShape = createTrigger({
|
|
149
360
|
// spaceId: space.id,
|
|
150
|
-
// triggerKind:
|
|
361
|
+
// triggerKind: 'email',
|
|
151
362
|
// ...position({ x: -18, y: -2 }),
|
|
152
363
|
// });
|
|
153
364
|
// const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -209,8 +420,17 @@ export const generator = () => ({
|
|
|
209
420
|
builder
|
|
210
421
|
.createEdge({ source: chat.id, target: gpt.id, input: 'prompt' })
|
|
211
422
|
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
212
|
-
.createEdge({
|
|
213
|
-
|
|
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
|
+
});
|
|
214
434
|
});
|
|
215
435
|
|
|
216
436
|
const computeModel = createComputeGraph(canvasModel);
|
|
@@ -254,7 +474,7 @@ export const generator = () => ({
|
|
|
254
474
|
// );
|
|
255
475
|
// const triggerShape = createTrigger({
|
|
256
476
|
// spaceId: space.id,
|
|
257
|
-
// triggerKind:
|
|
477
|
+
// triggerKind: 'email',
|
|
258
478
|
// ...rawPosition({ centerX: -736, centerY: -384, width: 182, height: 192 }),
|
|
259
479
|
// });
|
|
260
480
|
// const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -334,9 +554,21 @@ export const generator = () => ({
|
|
|
334
554
|
const view = canvasModel.createNode(createSurface(position({ x: 12, y: 0 })));
|
|
335
555
|
|
|
336
556
|
builder
|
|
337
|
-
.createEdge({
|
|
338
|
-
|
|
339
|
-
|
|
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
|
+
});
|
|
340
572
|
});
|
|
341
573
|
|
|
342
574
|
const computeModel = createComputeGraph(canvasModel);
|
|
@@ -354,17 +586,20 @@ export const generator = () => ({
|
|
|
354
586
|
const objects = range(n, () => {
|
|
355
587
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
356
588
|
|
|
357
|
-
let functionTrigger:
|
|
589
|
+
let functionTrigger: Trigger.Trigger | undefined;
|
|
358
590
|
canvasModel.builder.call((builder) => {
|
|
359
591
|
const triggerShape = createTrigger({
|
|
360
592
|
spaceId: space.id,
|
|
361
|
-
triggerKind:
|
|
593
|
+
triggerKind: 'timer',
|
|
362
594
|
...position({ x: -10, y: -5 }),
|
|
363
595
|
});
|
|
364
596
|
const trigger = canvasModel.createNode(triggerShape);
|
|
365
597
|
// DXOS dev-null channel.
|
|
366
598
|
const channelId = canvasModel.createNode(
|
|
367
|
-
createConstant({
|
|
599
|
+
createConstant({
|
|
600
|
+
value: '1088569858767212554',
|
|
601
|
+
...position({ x: -10, y: 0 }),
|
|
602
|
+
}),
|
|
368
603
|
);
|
|
369
604
|
const queueId = canvasModel.createNode(
|
|
370
605
|
createConstant({
|
|
@@ -377,11 +612,31 @@ export const generator = () => ({
|
|
|
377
612
|
const queue = canvasModel.createNode(createQueue(position({ x: 0, y: 12 })));
|
|
378
613
|
|
|
379
614
|
builder
|
|
380
|
-
.createEdge({
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
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
|
+
});
|
|
385
640
|
|
|
386
641
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
387
642
|
});
|
|
@@ -416,7 +671,7 @@ export const generator = () => ({
|
|
|
416
671
|
// canvasModel.builder.call((builder) => {
|
|
417
672
|
// const triggerShape = createTrigger({
|
|
418
673
|
// spaceId: space.id,
|
|
419
|
-
// triggerKind:
|
|
674
|
+
// triggerKind: 'queue',
|
|
420
675
|
// ...position({ x: -10, y: -5 }),
|
|
421
676
|
// });
|
|
422
677
|
// const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -448,10 +703,10 @@ export const generator = () => ({
|
|
|
448
703
|
] as [PresetName, ObjectGenerator<any>][],
|
|
449
704
|
});
|
|
450
705
|
|
|
451
|
-
const createQueueSinkPreset = <SpecType extends
|
|
706
|
+
const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
452
707
|
space: Space,
|
|
453
708
|
triggerKind: SpecType,
|
|
454
|
-
initSpec: (spec: Extract<
|
|
709
|
+
initSpec: (spec: Obj.Mutable<Extract<Trigger.Spec, { kind: SpecType }>>) => void,
|
|
455
710
|
triggerOutputName: string,
|
|
456
711
|
) => {
|
|
457
712
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
@@ -463,7 +718,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
463
718
|
}),
|
|
464
719
|
);
|
|
465
720
|
|
|
466
|
-
let functionTrigger:
|
|
721
|
+
let functionTrigger: Trigger.Trigger | undefined;
|
|
467
722
|
canvasModel.builder.call((builder) => {
|
|
468
723
|
const triggerShape = createTrigger({
|
|
469
724
|
spaceId: space.id,
|
|
@@ -484,7 +739,12 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
484
739
|
builder
|
|
485
740
|
.createEdge({ source: queueId.id, target: append.id, input: 'id' })
|
|
486
741
|
.createEdge({ source: template.id, target: append.id, input: 'items' })
|
|
487
|
-
.createEdge({
|
|
742
|
+
.createEdge({
|
|
743
|
+
source: trigger.id,
|
|
744
|
+
target: template.id,
|
|
745
|
+
output: triggerOutputName,
|
|
746
|
+
input: 'type',
|
|
747
|
+
})
|
|
488
748
|
.createEdge({
|
|
489
749
|
source: random.id,
|
|
490
750
|
target: template.id,
|
|
@@ -494,13 +754,16 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
494
754
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
495
755
|
const triggerSpec = functionTrigger.spec;
|
|
496
756
|
invariant(triggerSpec && triggerSpec.kind === triggerKind, 'No trigger spec.');
|
|
497
|
-
|
|
757
|
+
Obj.change(functionTrigger, (ft) => {
|
|
758
|
+
initSpec(ft.spec as any);
|
|
759
|
+
});
|
|
498
760
|
});
|
|
499
761
|
|
|
500
762
|
const computeModel = createComputeGraph(canvasModel);
|
|
501
763
|
|
|
502
764
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
503
765
|
invariant(templateComputeNode, 'Template compute node was not created.');
|
|
766
|
+
// NOTE: These are plain object mutations during model construction, not ECHO object mutations.
|
|
504
767
|
templateComputeNode.value = ['{', ' "@type": "{{type}}",', ' "id": "@{{changeId}}"', '}'].join('\n');
|
|
505
768
|
templateComputeNode.inputSchema = Type.toJsonSchema(Schema.Struct({ type: Schema.String, changeId: Schema.String }));
|
|
506
769
|
attachTrigger(functionTrigger, computeModel);
|
|
@@ -510,7 +773,7 @@ const createQueueSinkPreset = <SpecType extends TriggerKind>(
|
|
|
510
773
|
|
|
511
774
|
const addToSpace = (name: string, space: Space, canvas: CanvasGraphModel, compute: ComputeGraphModel) => {
|
|
512
775
|
return space.db.add(
|
|
513
|
-
Obj.make(
|
|
776
|
+
Obj.make(CanvasBoard.CanvasBoard, {
|
|
514
777
|
name,
|
|
515
778
|
computeGraph: Ref.make(compute.root),
|
|
516
779
|
layout: canvas.graph,
|
|
@@ -538,17 +801,27 @@ const setupQueue = (
|
|
|
538
801
|
return { queue, queueId };
|
|
539
802
|
};
|
|
540
803
|
|
|
541
|
-
const attachTrigger = (functionTrigger:
|
|
804
|
+
const attachTrigger = (functionTrigger: Trigger.Trigger | undefined, computeModel: ComputeGraphModel) => {
|
|
542
805
|
invariant(functionTrigger);
|
|
543
|
-
functionTrigger.function = Ref.make(computeModel.root);
|
|
544
806
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
|
|
545
|
-
functionTrigger
|
|
807
|
+
Obj.change(functionTrigger, (t) => {
|
|
808
|
+
t.function = Ref.make(computeModel.root);
|
|
809
|
+
t.inputNodeId = inputNode.id;
|
|
810
|
+
});
|
|
546
811
|
};
|
|
547
812
|
|
|
548
|
-
type RawPositionInput = {
|
|
813
|
+
type RawPositionInput = {
|
|
814
|
+
centerX: number;
|
|
815
|
+
centerY: number;
|
|
816
|
+
width: number;
|
|
817
|
+
height: number;
|
|
818
|
+
};
|
|
549
819
|
|
|
550
820
|
const rawPosition = (args: RawPositionInput) => {
|
|
551
|
-
return {
|
|
821
|
+
return {
|
|
822
|
+
center: { x: args.centerX, y: args.centerY },
|
|
823
|
+
size: { width: args.width, height: args.height },
|
|
824
|
+
};
|
|
552
825
|
};
|
|
553
826
|
|
|
554
827
|
const position = (rect: { x: number; y: number; width?: number; height?: number }) => {
|
|
@@ -556,7 +829,10 @@ const position = (rect: { x: number; y: number; width?: number; height?: number
|
|
|
556
829
|
const [center, size] = rectToPoints({ width: 0, height: 0, ...rect });
|
|
557
830
|
const { x, y, width, height } = pointsToRect([pointMultiply(center, snap), pointMultiply(size, snap)]);
|
|
558
831
|
if (width && height) {
|
|
559
|
-
return {
|
|
832
|
+
return {
|
|
833
|
+
center: { x, y },
|
|
834
|
+
size: width && height ? { width, height } : undefined,
|
|
835
|
+
};
|
|
560
836
|
} else {
|
|
561
837
|
return { center: { x, y } };
|
|
562
838
|
}
|
|
@@ -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'],
|