@dxos/plugin-debug 0.8.3 → 0.8.4-main.1f223c7
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-EDOH6R2G.mjs +20 -0
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +7 -0
- package/dist/lib/browser/{DevtoolsOverviewContainer-IIIWO77Q.mjs → DevtoolsOverviewContainer-EPD6EWT5.mjs} +2 -2
- package/dist/lib/browser/{SpaceGenerator-VB6IB2LL.mjs → SpaceGenerator-SRCIEELZ.mjs} +355 -492
- package/dist/lib/browser/SpaceGenerator-SRCIEELZ.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-6HHJMKVU.mjs → app-graph-builder-JTIEFOWZ.mjs} +25 -35
- package/dist/lib/browser/app-graph-builder-JTIEFOWZ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-47JOZTT2.mjs → chunk-5XPIRNQS.mjs} +2 -2
- package/dist/lib/browser/{chunk-KS3YBEL7.mjs → chunk-AJA6RYN3.mjs} +2 -2
- package/dist/lib/browser/index.mjs +17 -14
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-context-ZQRD2WG2.mjs → react-context-NVAGLAJD.mjs} +3 -3
- package/dist/lib/browser/{react-surface-UI6OK73H.mjs → react-surface-HQPOGG33.mjs} +43 -38
- package/dist/lib/browser/react-surface-HQPOGG33.mjs.map +7 -0
- package/dist/lib/browser/{settings-SXQWSIM4.mjs → settings-LSSWLM5I.mjs} +4 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +5 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/components/DebugGraph.d.ts +8 -0
- package/dist/types/src/components/DebugGraph.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +3 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +13 -3
- 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 +5 -5
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +62 -60
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +60 -59
- package/src/DebugPlugin.tsx +2 -2
- package/src/capabilities/app-graph-builder.ts +13 -40
- package/src/capabilities/react-surface.tsx +9 -8
- package/src/components/DebugGraph.tsx +14 -0
- package/src/components/DebugObjectPanel.tsx +1 -1
- package/src/components/DebugSettings.tsx +72 -64
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +32 -26
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +8 -6
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +15 -72
- package/src/components/SpaceGenerator/draw-util.ts +3 -3
- package/src/components/SpaceGenerator/presets.ts +324 -221
- package/src/components/Wireframe.tsx +2 -1
- package/src/components/index.ts +1 -1
- package/src/translations.ts +8 -4
- package/dist/lib/browser/DebugApp-WSEJPCKY.mjs +0 -225
- package/dist/lib/browser/DebugApp-WSEJPCKY.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-VB6IB2LL.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-6HHJMKVU.mjs.map +0 -7
- package/dist/lib/browser/react-surface-UI6OK73H.mjs.map +0 -7
- 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/components/DebugApp/DebugApp.tsx +0 -77
- package/src/components/DebugApp/Tree.tsx +0 -103
- package/src/components/DebugApp/index.ts +0 -7
- /package/dist/lib/browser/{DevtoolsOverviewContainer-IIIWO77Q.mjs.map → DevtoolsOverviewContainer-EPD6EWT5.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-47JOZTT2.mjs.map → chunk-5XPIRNQS.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-KS3YBEL7.mjs.map → chunk-AJA6RYN3.mjs.map} +0 -0
- /package/dist/lib/browser/{react-context-ZQRD2WG2.mjs.map → react-context-NVAGLAJD.mjs.map} +0 -0
- /package/dist/lib/browser/{settings-SXQWSIM4.mjs.map → settings-LSSWLM5I.mjs.map} +0 -0
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Schema
|
|
5
|
+
import { Schema } from 'effect';
|
|
6
6
|
|
|
7
|
+
import { ResearchOn, research } from '@dxos/assistant-testing';
|
|
7
8
|
import { type ComputeGraphModel, NODE_INPUT } from '@dxos/conductor';
|
|
8
|
-
import { DXN, Key, Obj, Ref, Type } from '@dxos/echo';
|
|
9
|
-
import { FunctionTrigger, TriggerKind,
|
|
9
|
+
import { DXN, Filter, Key, Obj, Query, Ref, Relation, Type } from '@dxos/echo';
|
|
10
|
+
import { FunctionTrigger, type TriggerKind, type TriggerType, serializeFunction } from '@dxos/functions';
|
|
10
11
|
import { invariant } from '@dxos/invariant';
|
|
11
|
-
import {
|
|
12
|
+
import { Mailbox } from '@dxos/plugin-inbox/types';
|
|
13
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
14
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
12
15
|
import {
|
|
13
16
|
type ComputeShape,
|
|
14
17
|
createAppend,
|
|
@@ -18,8 +21,8 @@ import {
|
|
|
18
21
|
createFunction,
|
|
19
22
|
createGpt,
|
|
20
23
|
createQueue,
|
|
21
|
-
createSurface,
|
|
22
24
|
createRandom,
|
|
25
|
+
createSurface,
|
|
23
26
|
createTemplate,
|
|
24
27
|
createText,
|
|
25
28
|
createTrigger,
|
|
@@ -31,27 +34,124 @@ import {
|
|
|
31
34
|
pointsToRect,
|
|
32
35
|
rectToPoints,
|
|
33
36
|
} from '@dxos/react-ui-canvas-editor';
|
|
34
|
-
import {
|
|
37
|
+
import { DataType, createView } from '@dxos/schema';
|
|
35
38
|
import { range } from '@dxos/util';
|
|
36
39
|
|
|
37
40
|
import { type ObjectGenerator } from './ObjectGenerator';
|
|
38
41
|
|
|
39
42
|
export enum PresetName {
|
|
40
|
-
|
|
43
|
+
DXOS_TEAM = 'dxos-team',
|
|
44
|
+
ORG_RESEARCH_PROJECT = 'org-research-project',
|
|
45
|
+
// EMAIL_TABLE = 'email-table',
|
|
41
46
|
GPT_QUEUE = 'webhook-gpt-queue',
|
|
42
47
|
CHAT_GPT = 'chat-gpt-text',
|
|
43
|
-
EMAIL_WITH_SUMMARY = 'email-gptSummary-table',
|
|
48
|
+
// EMAIL_WITH_SUMMARY = 'email-gptSummary-table',
|
|
44
49
|
OBJECT_CHANGE_QUEUE = 'objectChange-queue',
|
|
45
50
|
FOREX_FUNCTION_CALL = 'forex-function-call',
|
|
46
51
|
TIMER_TICK_QUEUE = 'timerTick-queue',
|
|
47
52
|
DISCORD_MESSAGES = 'discord-messages',
|
|
48
|
-
KANBAN_QUEUE = 'kanban-queue',
|
|
53
|
+
// KANBAN_QUEUE = 'kanban-queue',
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
export const generator = () => ({
|
|
52
57
|
schemas: [CanvasBoardType, FunctionTrigger],
|
|
53
58
|
types: Object.values(PresetName).map((name) => ({ typename: name })),
|
|
54
59
|
items: [
|
|
60
|
+
[
|
|
61
|
+
PresetName.DXOS_TEAM,
|
|
62
|
+
async (space, n, cb) => {
|
|
63
|
+
const objects = range(n, () => {
|
|
64
|
+
const org = space.db.add(Obj.make(DataType.Organization, { name: 'DXOS', website: 'https://dxos.org' }));
|
|
65
|
+
|
|
66
|
+
const doc = space.db.add(
|
|
67
|
+
Markdown.makeDocument({
|
|
68
|
+
name: 'DXOS Research',
|
|
69
|
+
content: 'DXOS builds Composer, an open-source AI-powered malleable application.',
|
|
70
|
+
}),
|
|
71
|
+
);
|
|
72
|
+
space.db.add(
|
|
73
|
+
Relation.make(ResearchOn, {
|
|
74
|
+
[Relation.Source]: doc,
|
|
75
|
+
[Relation.Target]: org,
|
|
76
|
+
completedAt: new Date().toISOString(),
|
|
77
|
+
}),
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
space.db.add(
|
|
81
|
+
Obj.make(DataType.Person, { fullName: 'Rich', jobTitle: 'investor', organization: Ref.make(org) }),
|
|
82
|
+
);
|
|
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
|
+
|
|
88
|
+
return doc;
|
|
89
|
+
});
|
|
90
|
+
cb?.(objects);
|
|
91
|
+
return objects;
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
[
|
|
95
|
+
PresetName.ORG_RESEARCH_PROJECT,
|
|
96
|
+
async (space, n, cb) => {
|
|
97
|
+
const mailbox = await space.db.query(Filter.type(Mailbox.Mailbox)).first();
|
|
98
|
+
|
|
99
|
+
const objects = range(n, () => {
|
|
100
|
+
// TODO(wittjosiah): Move filter to another property.
|
|
101
|
+
const contactsQuery = Query.select(Filter.type(DataType.Person, { jobTitle: 'investor' }));
|
|
102
|
+
const organizationsQuery = contactsQuery.reference('organization');
|
|
103
|
+
const notesQuery = organizationsQuery.targetOf(ResearchOn).source();
|
|
104
|
+
|
|
105
|
+
const researchTrigger = Obj.make(FunctionTrigger, {
|
|
106
|
+
function: Ref.make(serializeFunction(research)),
|
|
107
|
+
spec: {
|
|
108
|
+
kind: 'subscription',
|
|
109
|
+
query: organizationsQuery.ast,
|
|
110
|
+
},
|
|
111
|
+
enabled: true,
|
|
112
|
+
});
|
|
113
|
+
space.db.add(researchTrigger);
|
|
114
|
+
|
|
115
|
+
const mailboxView = createView({
|
|
116
|
+
name: 'Mailbox',
|
|
117
|
+
query: Query.select(
|
|
118
|
+
Filter.type(DataType.Message, { properties: { labels: Filter.contains('investor') } }),
|
|
119
|
+
).options({
|
|
120
|
+
queues: [mailbox.queue.dxn.toString()],
|
|
121
|
+
}),
|
|
122
|
+
jsonSchema: Type.toJsonSchema(DataType.Message),
|
|
123
|
+
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
124
|
+
});
|
|
125
|
+
const contactsView = createView({
|
|
126
|
+
name: 'Contacts',
|
|
127
|
+
query: contactsQuery,
|
|
128
|
+
jsonSchema: Type.toJsonSchema(DataType.Person),
|
|
129
|
+
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
130
|
+
});
|
|
131
|
+
const organizationsView = createView({
|
|
132
|
+
name: 'Organizations',
|
|
133
|
+
query: organizationsQuery,
|
|
134
|
+
jsonSchema: Type.toJsonSchema(DataType.Organization),
|
|
135
|
+
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
136
|
+
});
|
|
137
|
+
const notesView = createView({
|
|
138
|
+
name: 'Notes',
|
|
139
|
+
query: notesQuery,
|
|
140
|
+
jsonSchema: Type.toJsonSchema(Markdown.Document),
|
|
141
|
+
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
return space.db.add(
|
|
145
|
+
DataType.makeProject({
|
|
146
|
+
name: 'Investor Research',
|
|
147
|
+
collections: [mailboxView, contactsView, organizationsView, notesView].map((view) => Ref.make(view)),
|
|
148
|
+
}),
|
|
149
|
+
);
|
|
150
|
+
});
|
|
151
|
+
cb?.(objects.flat());
|
|
152
|
+
return objects.flat();
|
|
153
|
+
},
|
|
154
|
+
],
|
|
55
155
|
[
|
|
56
156
|
PresetName.GPT_QUEUE,
|
|
57
157
|
async (space, n, cb) => {
|
|
@@ -63,7 +163,7 @@ export const generator = () => ({
|
|
|
63
163
|
const gpt = canvasModel.createNode(createGpt(position({ x: 0, y: -14 })));
|
|
64
164
|
const triggerShape = createTrigger({
|
|
65
165
|
spaceId: space.id,
|
|
66
|
-
triggerKind:
|
|
166
|
+
triggerKind: 'webhook',
|
|
67
167
|
...position({ x: -18, y: -2 }),
|
|
68
168
|
});
|
|
69
169
|
const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -97,8 +197,8 @@ export const generator = () => ({
|
|
|
97
197
|
const objects = range(n, () => {
|
|
98
198
|
const { canvasModel, computeModel } = createQueueSinkPreset(
|
|
99
199
|
space,
|
|
100
|
-
|
|
101
|
-
(triggerSpec) => (triggerSpec.
|
|
200
|
+
'subscription',
|
|
201
|
+
(triggerSpec) => (triggerSpec.query = Query.select(Filter.typename('dxos.org/type/Chess')).ast),
|
|
102
202
|
'type',
|
|
103
203
|
);
|
|
104
204
|
return addToSpace(PresetName.OBJECT_CHANGE_QUEUE, space, canvasModel, computeModel);
|
|
@@ -114,7 +214,7 @@ export const generator = () => ({
|
|
|
114
214
|
const objects = range(n, () => {
|
|
115
215
|
const { canvasModel, computeModel } = createQueueSinkPreset(
|
|
116
216
|
space,
|
|
117
|
-
|
|
217
|
+
'timer',
|
|
118
218
|
(triggerSpec) => (triggerSpec.cron = '*/5 * * * * *'),
|
|
119
219
|
'result',
|
|
120
220
|
);
|
|
@@ -125,72 +225,73 @@ export const generator = () => ({
|
|
|
125
225
|
},
|
|
126
226
|
],
|
|
127
227
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
228
|
+
// TODO(wittjosiah): Remove?
|
|
229
|
+
// [
|
|
230
|
+
// PresetName.EMAIL_TABLE,
|
|
231
|
+
// async (space, n, cb) => {
|
|
232
|
+
// const objects = range(n, () => {
|
|
233
|
+
// const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
234
|
+
|
|
235
|
+
// const results = space.db.query(Filter.type(TableType)).runSync();
|
|
236
|
+
// const emailTable = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Email'));
|
|
237
|
+
// invariant(emailTable, 'Email table not found.');
|
|
238
|
+
|
|
239
|
+
// const template = canvasModel.createNode(
|
|
240
|
+
// createTemplate({
|
|
241
|
+
// valueType: 'object',
|
|
242
|
+
// ...rawPosition({ centerX: -80, centerY: -64, width: 320, height: 320 }),
|
|
243
|
+
// }),
|
|
244
|
+
// );
|
|
245
|
+
// const templateContent = ['{'];
|
|
246
|
+
|
|
247
|
+
// let functionTrigger: FunctionTrigger | undefined;
|
|
248
|
+
// canvasModel.builder.call((builder) => {
|
|
249
|
+
// const triggerShape = createTrigger({
|
|
250
|
+
// spaceId: space.id,
|
|
251
|
+
// triggerKind: 'email',
|
|
252
|
+
// ...position({ x: -18, y: -2 }),
|
|
253
|
+
// });
|
|
254
|
+
// const trigger = canvasModel.createNode(triggerShape);
|
|
255
|
+
|
|
256
|
+
// const tableId = canvasModel.createNode(
|
|
257
|
+
// createConstant({
|
|
258
|
+
// value: DXN.fromLocalObjectId(emailTable.id).toString(),
|
|
259
|
+
// ...position({ x: -18, y: 5, width: 8, height: 6 }),
|
|
260
|
+
// }),
|
|
261
|
+
// );
|
|
262
|
+
|
|
263
|
+
// const appendToTable = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
|
|
264
|
+
|
|
265
|
+
// const properties = SchemaAST.getPropertySignatures(EmailTriggerOutput.ast);
|
|
266
|
+
// for (let i = 0; i < properties.length; i++) {
|
|
267
|
+
// const propName = properties[i].name.toString();
|
|
268
|
+
// builder.createEdge({ source: trigger.id, target: template.id, input: propName, output: propName });
|
|
269
|
+
// templateContent.push(` "${propName}": "{{${propName}}}"` + (i === properties.length - 1 ? '' : ','));
|
|
270
|
+
// }
|
|
271
|
+
// templateContent.push('}');
|
|
272
|
+
|
|
273
|
+
// builder
|
|
274
|
+
// .createEdge({ source: tableId.id, target: appendToTable.id, input: 'id' })
|
|
275
|
+
// .createEdge({ source: template.id, target: appendToTable.id, input: 'items' });
|
|
276
|
+
|
|
277
|
+
// functionTrigger = triggerShape.functionTrigger!.target!;
|
|
278
|
+
// });
|
|
279
|
+
|
|
280
|
+
// const computeModel = createComputeGraph(canvasModel);
|
|
281
|
+
|
|
282
|
+
// const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
283
|
+
// invariant(templateComputeNode, 'Template compute node was not created.');
|
|
284
|
+
// templateComputeNode.value = templateContent.join('\n');
|
|
285
|
+
// templateComputeNode.inputSchema = Type.toJsonSchema(EmailTriggerOutput);
|
|
286
|
+
|
|
287
|
+
// attachTrigger(functionTrigger, computeModel);
|
|
288
|
+
|
|
289
|
+
// return addToSpace(PresetName.EMAIL_TABLE, space, canvasModel, computeModel);
|
|
290
|
+
// });
|
|
291
|
+
// cb?.(objects);
|
|
292
|
+
// return objects;
|
|
293
|
+
// },
|
|
294
|
+
// ],
|
|
194
295
|
|
|
195
296
|
[
|
|
196
297
|
PresetName.CHAT_GPT,
|
|
@@ -222,99 +323,100 @@ export const generator = () => ({
|
|
|
222
323
|
},
|
|
223
324
|
],
|
|
224
325
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
326
|
+
// TODO(wittjosiah): Remove?
|
|
327
|
+
// [
|
|
328
|
+
// PresetName.EMAIL_WITH_SUMMARY,
|
|
329
|
+
// async (space, n, cb) => {
|
|
330
|
+
// const objects = range(n, () => {
|
|
331
|
+
// const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
332
|
+
|
|
333
|
+
// const results = space.db.query(Filter.type(TableType)).runSync();
|
|
334
|
+
// const emailTable = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Email'));
|
|
335
|
+
// invariant(emailTable, 'Email table not found.');
|
|
336
|
+
|
|
337
|
+
// const template = canvasModel.createNode(
|
|
338
|
+
// createTemplate({
|
|
339
|
+
// valueType: 'object',
|
|
340
|
+
// ...rawPosition({ centerX: 192, centerY: -176, width: 320, height: 320 }),
|
|
341
|
+
// }),
|
|
342
|
+
// );
|
|
343
|
+
// const templateContent = ['{'];
|
|
344
|
+
|
|
345
|
+
// let functionTrigger: FunctionTrigger | undefined;
|
|
346
|
+
// canvasModel.builder.call((builder) => {
|
|
347
|
+
// const gpt = canvasModel.createNode(
|
|
348
|
+
// createGpt(rawPosition({ centerX: -400, centerY: -112, width: 256, height: 202 })),
|
|
349
|
+
// );
|
|
350
|
+
// const systemPrompt = canvasModel.createNode(
|
|
351
|
+
// createConstant({
|
|
352
|
+
// value: "use one word to describe content category. don't write anything else",
|
|
353
|
+
// ...rawPosition({ centerX: -800, centerY: -160, width: 192, height: 128 }),
|
|
354
|
+
// }),
|
|
355
|
+
// );
|
|
356
|
+
// const triggerShape = createTrigger({
|
|
357
|
+
// spaceId: space.id,
|
|
358
|
+
// triggerKind: 'email',
|
|
359
|
+
// ...rawPosition({ centerX: -736, centerY: -384, width: 182, height: 192 }),
|
|
360
|
+
// });
|
|
361
|
+
// const trigger = canvasModel.createNode(triggerShape);
|
|
362
|
+
|
|
363
|
+
// const { queueId } = setupQueue(space, canvasModel, {
|
|
364
|
+
// idPosition: { centerX: -720, centerY: 224, width: 192, height: 256 },
|
|
365
|
+
// queuePosition: { centerX: -144, centerY: 416, width: 320, height: 448 },
|
|
366
|
+
// });
|
|
367
|
+
// const appendToQueue = canvasModel.createNode(
|
|
368
|
+
// createAppend(rawPosition({ centerX: -80, centerY: 96, width: 122, height: 128 })),
|
|
369
|
+
// );
|
|
370
|
+
|
|
371
|
+
// const tableId = canvasModel.createNode(
|
|
372
|
+
// createConstant({
|
|
373
|
+
// value: DXN.fromLocalObjectId(emailTable.id).toString(),
|
|
374
|
+
// ...rawPosition({ centerX: -112, centerY: -544, width: 192, height: 256 }),
|
|
375
|
+
// }),
|
|
376
|
+
// );
|
|
377
|
+
|
|
378
|
+
// const appendToTable = canvasModel.createNode(
|
|
379
|
+
// createAppend(rawPosition({ centerX: 560, centerY: -416, width: 128, height: 122 })),
|
|
380
|
+
// );
|
|
381
|
+
|
|
382
|
+
// templateContent.push(' "category": "{{text}}",');
|
|
383
|
+
// builder.createEdge({ source: gpt.id, target: template.id, input: 'text', output: 'text' });
|
|
384
|
+
|
|
385
|
+
// const properties = SchemaAST.getPropertySignatures(EmailTriggerOutput.ast);
|
|
386
|
+
// for (let i = 0; i < properties.length; i++) {
|
|
387
|
+
// const propName = properties[i].name.toString();
|
|
388
|
+
// builder.createEdge({ source: trigger.id, target: template.id, input: propName, output: propName });
|
|
389
|
+
// templateContent.push(` "${propName}": "{{${propName}}}"` + (i === properties.length - 1 ? '' : ','));
|
|
390
|
+
// }
|
|
391
|
+
// templateContent.push('}');
|
|
392
|
+
|
|
393
|
+
// builder
|
|
394
|
+
// .createEdge({ source: tableId.id, target: appendToTable.id, input: 'id' })
|
|
395
|
+
// .createEdge({ source: queueId.id, target: appendToQueue.id, input: 'id' })
|
|
396
|
+
// .createEdge({ source: gpt.id, target: appendToQueue.id, output: 'messages', input: 'items' })
|
|
397
|
+
// .createEdge({ source: systemPrompt.id, target: gpt.id, input: 'systemPrompt' })
|
|
398
|
+
// .createEdge({ source: trigger.id, target: gpt.id, input: 'prompt', output: 'body' })
|
|
399
|
+
// .createEdge({ source: template.id, target: appendToTable.id, input: 'items' });
|
|
400
|
+
|
|
401
|
+
// functionTrigger = triggerShape.functionTrigger!.target!;
|
|
402
|
+
// });
|
|
403
|
+
|
|
404
|
+
// const computeModel = createComputeGraph(canvasModel);
|
|
405
|
+
|
|
406
|
+
// const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
407
|
+
// invariant(templateComputeNode, 'Template compute node was not created.');
|
|
408
|
+
// templateComputeNode.value = templateContent.join('\n');
|
|
409
|
+
// const extendedSchema = Schema.extend(EmailTriggerOutput, Schema.Struct({ text: Schema.String }));
|
|
410
|
+
// templateComputeNode.inputSchema = Type.toJsonSchema(extendedSchema);
|
|
411
|
+
|
|
412
|
+
// attachTrigger(functionTrigger, computeModel);
|
|
413
|
+
|
|
414
|
+
// return addToSpace(PresetName.EMAIL_WITH_SUMMARY, space, canvasModel, computeModel);
|
|
415
|
+
// });
|
|
416
|
+
// cb?.(objects);
|
|
417
|
+
// return objects;
|
|
418
|
+
// },
|
|
419
|
+
// ],
|
|
318
420
|
|
|
319
421
|
[
|
|
320
422
|
PresetName.FOREX_FUNCTION_CALL,
|
|
@@ -357,7 +459,7 @@ export const generator = () => ({
|
|
|
357
459
|
canvasModel.builder.call((builder) => {
|
|
358
460
|
const triggerShape = createTrigger({
|
|
359
461
|
spaceId: space.id,
|
|
360
|
-
triggerKind:
|
|
462
|
+
triggerKind: 'timer',
|
|
361
463
|
...position({ x: -10, y: -5 }),
|
|
362
464
|
});
|
|
363
465
|
const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -395,54 +497,55 @@ export const generator = () => ({
|
|
|
395
497
|
},
|
|
396
498
|
],
|
|
397
499
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
500
|
+
// TODO(wittjosiah): Remove?
|
|
501
|
+
// [
|
|
502
|
+
// PresetName.KANBAN_QUEUE,
|
|
503
|
+
// async (space, n, cb) => {
|
|
504
|
+
// const objects = range(n, () => {
|
|
505
|
+
// const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
506
|
+
|
|
507
|
+
// // TODO(wittjosiah): Integrate directly w/ Kanban.
|
|
508
|
+
// // const results = space.db.query(Filter.type(KanbanType)).runSync();
|
|
509
|
+
// // const kanban = results.find((r) => r.object?.cardView?.target?.query?.type?.endsWith('Message'));
|
|
510
|
+
// // invariant(kanban, 'Kanban not found.');
|
|
511
|
+
|
|
512
|
+
// const results = space.db.query(Filter.type(TableType)).runSync();
|
|
513
|
+
// const messages = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Message'));
|
|
514
|
+
// invariant(messages, 'Table not found.');
|
|
515
|
+
|
|
516
|
+
// let functionTrigger: FunctionTrigger | undefined;
|
|
517
|
+
// canvasModel.builder.call((builder) => {
|
|
518
|
+
// const triggerShape = createTrigger({
|
|
519
|
+
// spaceId: space.id,
|
|
520
|
+
// triggerKind: 'queue',
|
|
521
|
+
// ...position({ x: -10, y: -5 }),
|
|
522
|
+
// });
|
|
523
|
+
// const trigger = canvasModel.createNode(triggerShape);
|
|
524
|
+
|
|
525
|
+
// const tableId = canvasModel.createNode(
|
|
526
|
+
// createConstant({
|
|
527
|
+
// value: DXN.fromLocalObjectId(messages.id).toString(),
|
|
528
|
+
// ...position({ x: -10, y: 5 }),
|
|
529
|
+
// }),
|
|
530
|
+
// );
|
|
531
|
+
// const appendToTable = canvasModel.createNode(createAppend(position({ x: 10, y: 0 })));
|
|
532
|
+
|
|
533
|
+
// builder
|
|
534
|
+
// .createEdge({ source: tableId.id, target: appendToTable.id, input: 'id' })
|
|
535
|
+
// .createEdge({ source: trigger.id, target: appendToTable.id, input: 'items', output: 'item' });
|
|
536
|
+
|
|
537
|
+
// functionTrigger = triggerShape.functionTrigger!.target!;
|
|
538
|
+
// });
|
|
539
|
+
|
|
540
|
+
// const computeModel = createComputeGraph(canvasModel);
|
|
541
|
+
// attachTrigger(functionTrigger, computeModel);
|
|
542
|
+
|
|
543
|
+
// return addToSpace(PresetName.KANBAN_QUEUE, space, canvasModel, computeModel);
|
|
544
|
+
// });
|
|
545
|
+
// cb?.(objects);
|
|
546
|
+
// return objects;
|
|
547
|
+
// },
|
|
548
|
+
// ],
|
|
446
549
|
] as [PresetName, ObjectGenerator<any>][],
|
|
447
550
|
});
|
|
448
551
|
|