@dxos/plugin-debug 0.8.3 → 0.8.4-main.1da679c
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-SB2YRVRT.mjs} +376 -494
- package/dist/lib/browser/SpaceGenerator-SB2YRVRT.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-6HHJMKVU.mjs → app-graph-builder-7ODCSP7R.mjs} +27 -37
- package/dist/lib/browser/app-graph-builder-7ODCSP7R.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-Y537DXK5.mjs} +5 -5
- package/dist/lib/browser/{react-context-ZQRD2WG2.mjs.map → react-context-Y537DXK5.mjs.map} +1 -1
- package/dist/lib/browser/{react-surface-UI6OK73H.mjs → react-surface-OP75RFNI.mjs} +45 -40
- package/dist/lib/browser/react-surface-OP75RFNI.mjs.map +7 -0
- package/dist/lib/browser/{settings-SXQWSIM4.mjs → settings-XAUQOU7I.mjs} +6 -6
- package/dist/lib/browser/{settings-SXQWSIM4.mjs.map → settings-XAUQOU7I.mjs.map} +1 -1
- 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 +61 -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 +346 -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
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Schema
|
|
5
|
+
import { Schema } from 'effect';
|
|
6
6
|
|
|
7
|
+
import { RESEARCH_BLUEPRINT, ResearchOn, agent } from '@dxos/assistant-testing';
|
|
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 { FunctionTrigger, TriggerKind,
|
|
10
|
+
import { DXN, Filter, Key, Obj, Query, Ref, Relation, Type } from '@dxos/echo';
|
|
11
|
+
import { FunctionTrigger, type TriggerKind, type TriggerType, serializeFunction } from '@dxos/functions';
|
|
10
12
|
import { invariant } from '@dxos/invariant';
|
|
11
|
-
import {
|
|
13
|
+
import { Mailbox } from '@dxos/plugin-inbox/types';
|
|
14
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
15
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
12
16
|
import {
|
|
13
17
|
type ComputeShape,
|
|
14
18
|
createAppend,
|
|
@@ -18,8 +22,8 @@ import {
|
|
|
18
22
|
createFunction,
|
|
19
23
|
createGpt,
|
|
20
24
|
createQueue,
|
|
21
|
-
createSurface,
|
|
22
25
|
createRandom,
|
|
26
|
+
createSurface,
|
|
23
27
|
createTemplate,
|
|
24
28
|
createText,
|
|
25
29
|
createTrigger,
|
|
@@ -31,27 +35,145 @@ import {
|
|
|
31
35
|
pointsToRect,
|
|
32
36
|
rectToPoints,
|
|
33
37
|
} from '@dxos/react-ui-canvas-editor';
|
|
34
|
-
import {
|
|
38
|
+
import { DataType, createView } from '@dxos/schema';
|
|
35
39
|
import { range } from '@dxos/util';
|
|
36
40
|
|
|
37
41
|
import { type ObjectGenerator } from './ObjectGenerator';
|
|
38
42
|
|
|
39
43
|
export enum PresetName {
|
|
40
|
-
|
|
44
|
+
DXOS_TEAM = 'dxos-team',
|
|
45
|
+
ORG_RESEARCH_PROJECT = 'org-research-project',
|
|
46
|
+
// EMAIL_TABLE = 'email-table',
|
|
41
47
|
GPT_QUEUE = 'webhook-gpt-queue',
|
|
42
48
|
CHAT_GPT = 'chat-gpt-text',
|
|
43
|
-
EMAIL_WITH_SUMMARY = 'email-gptSummary-table',
|
|
49
|
+
// EMAIL_WITH_SUMMARY = 'email-gptSummary-table',
|
|
44
50
|
OBJECT_CHANGE_QUEUE = 'objectChange-queue',
|
|
45
51
|
FOREX_FUNCTION_CALL = 'forex-function-call',
|
|
46
52
|
TIMER_TICK_QUEUE = 'timerTick-queue',
|
|
47
53
|
DISCORD_MESSAGES = 'discord-messages',
|
|
48
|
-
KANBAN_QUEUE = 'kanban-queue',
|
|
54
|
+
// KANBAN_QUEUE = 'kanban-queue',
|
|
49
55
|
}
|
|
50
56
|
|
|
51
57
|
export const generator = () => ({
|
|
52
58
|
schemas: [CanvasBoardType, FunctionTrigger],
|
|
53
59
|
types: Object.values(PresetName).map((name) => ({ typename: name })),
|
|
54
60
|
items: [
|
|
61
|
+
[
|
|
62
|
+
PresetName.DXOS_TEAM,
|
|
63
|
+
async (space, n, cb) => {
|
|
64
|
+
const objects = range(n, () => {
|
|
65
|
+
const org = space.db.add(Obj.make(DataType.Organization, { name: 'DXOS', website: 'https://dxos.org' }));
|
|
66
|
+
|
|
67
|
+
const doc = space.db.add(
|
|
68
|
+
Markdown.makeDocument({
|
|
69
|
+
name: 'DXOS Research',
|
|
70
|
+
content: 'DXOS builds Composer, an open-source AI-powered malleable application.',
|
|
71
|
+
}),
|
|
72
|
+
);
|
|
73
|
+
space.db.add(
|
|
74
|
+
Relation.make(ResearchOn, {
|
|
75
|
+
[Relation.Source]: doc,
|
|
76
|
+
[Relation.Target]: org,
|
|
77
|
+
completedAt: new Date().toISOString(),
|
|
78
|
+
}),
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
space.db.add(
|
|
82
|
+
Obj.make(DataType.Person, { fullName: 'Rich', jobTitle: 'investor', organization: Ref.make(org) }),
|
|
83
|
+
);
|
|
84
|
+
space.db.add(Obj.make(DataType.Person, { fullName: 'Josiah', organization: Ref.make(org) }));
|
|
85
|
+
space.db.add(Obj.make(DataType.Person, { fullName: 'Dima', organization: Ref.make(org) }));
|
|
86
|
+
space.db.add(Obj.make(DataType.Person, { fullName: 'Mykola', organization: Ref.make(org) }));
|
|
87
|
+
space.db.add(Obj.make(DataType.Person, { fullName: 'Will', organization: Ref.make(org) }));
|
|
88
|
+
|
|
89
|
+
return doc;
|
|
90
|
+
});
|
|
91
|
+
cb?.(objects);
|
|
92
|
+
return objects;
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
PresetName.ORG_RESEARCH_PROJECT,
|
|
97
|
+
async (space, n, cb) => {
|
|
98
|
+
const mailbox = await space.db.query(Filter.type(Mailbox.Mailbox)).first();
|
|
99
|
+
|
|
100
|
+
const objects = range(n, () => {
|
|
101
|
+
// TODO(wittjosiah): Move filter to another property.
|
|
102
|
+
const contactsQuery = Query.select(Filter.type(DataType.Person, { jobTitle: 'investor' }));
|
|
103
|
+
const organizationsQuery = contactsQuery.reference('organization');
|
|
104
|
+
const notesQuery = organizationsQuery.targetOf(ResearchOn).source();
|
|
105
|
+
|
|
106
|
+
const researchPrompt = space.db.add(
|
|
107
|
+
Prompt.make({
|
|
108
|
+
name: 'Research',
|
|
109
|
+
description: 'Research organization',
|
|
110
|
+
input: Schema.Struct({
|
|
111
|
+
org: Schema.Any,
|
|
112
|
+
}),
|
|
113
|
+
output: Schema.Any,
|
|
114
|
+
|
|
115
|
+
// TODO(dmaretskyi): This mocks research (returns pre-baked result), the actual research might take compute minutes.
|
|
116
|
+
// Remove the mock prompt to do the actual research.
|
|
117
|
+
instructions:
|
|
118
|
+
'Research the organization provided as input. Create a research note for it at the end. NOTE: Do mocked reseach (set mockSearch to true).',
|
|
119
|
+
blueprints: [Ref.make(RESEARCH_BLUEPRINT)],
|
|
120
|
+
}),
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
const researchTrigger = Obj.make(FunctionTrigger, {
|
|
124
|
+
enabled: true,
|
|
125
|
+
spec: {
|
|
126
|
+
kind: 'subscription',
|
|
127
|
+
query: organizationsQuery.ast,
|
|
128
|
+
},
|
|
129
|
+
function: Ref.make(serializeFunction(agent)),
|
|
130
|
+
input: {
|
|
131
|
+
prompt: Ref.make(researchPrompt),
|
|
132
|
+
input: '{{event.subject}}',
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
space.db.add(researchTrigger);
|
|
136
|
+
|
|
137
|
+
const mailboxView = createView({
|
|
138
|
+
name: 'Mailbox',
|
|
139
|
+
query: Query.select(
|
|
140
|
+
Filter.type(DataType.Message, { properties: { labels: Filter.contains('investor') } }),
|
|
141
|
+
).options({
|
|
142
|
+
queues: [mailbox.queue.dxn.toString()],
|
|
143
|
+
}),
|
|
144
|
+
jsonSchema: Type.toJsonSchema(DataType.Message),
|
|
145
|
+
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
146
|
+
});
|
|
147
|
+
const contactsView = createView({
|
|
148
|
+
name: 'Contacts',
|
|
149
|
+
query: contactsQuery,
|
|
150
|
+
jsonSchema: Type.toJsonSchema(DataType.Person),
|
|
151
|
+
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
152
|
+
});
|
|
153
|
+
const organizationsView = createView({
|
|
154
|
+
name: 'Organizations',
|
|
155
|
+
query: organizationsQuery,
|
|
156
|
+
jsonSchema: Type.toJsonSchema(DataType.Organization),
|
|
157
|
+
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
158
|
+
});
|
|
159
|
+
const notesView = createView({
|
|
160
|
+
name: 'Notes',
|
|
161
|
+
query: notesQuery,
|
|
162
|
+
jsonSchema: Type.toJsonSchema(Markdown.Document),
|
|
163
|
+
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
return space.db.add(
|
|
167
|
+
DataType.makeProject({
|
|
168
|
+
name: 'Investor Research',
|
|
169
|
+
collections: [mailboxView, contactsView, organizationsView, notesView].map((view) => Ref.make(view)),
|
|
170
|
+
}),
|
|
171
|
+
);
|
|
172
|
+
});
|
|
173
|
+
cb?.(objects.flat());
|
|
174
|
+
return objects.flat();
|
|
175
|
+
},
|
|
176
|
+
],
|
|
55
177
|
[
|
|
56
178
|
PresetName.GPT_QUEUE,
|
|
57
179
|
async (space, n, cb) => {
|
|
@@ -63,7 +185,7 @@ export const generator = () => ({
|
|
|
63
185
|
const gpt = canvasModel.createNode(createGpt(position({ x: 0, y: -14 })));
|
|
64
186
|
const triggerShape = createTrigger({
|
|
65
187
|
spaceId: space.id,
|
|
66
|
-
triggerKind:
|
|
188
|
+
triggerKind: 'webhook',
|
|
67
189
|
...position({ x: -18, y: -2 }),
|
|
68
190
|
});
|
|
69
191
|
const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -97,8 +219,8 @@ export const generator = () => ({
|
|
|
97
219
|
const objects = range(n, () => {
|
|
98
220
|
const { canvasModel, computeModel } = createQueueSinkPreset(
|
|
99
221
|
space,
|
|
100
|
-
|
|
101
|
-
(triggerSpec) => (triggerSpec.
|
|
222
|
+
'subscription',
|
|
223
|
+
(triggerSpec) => (triggerSpec.query = Query.select(Filter.typename('dxos.org/type/Chess')).ast),
|
|
102
224
|
'type',
|
|
103
225
|
);
|
|
104
226
|
return addToSpace(PresetName.OBJECT_CHANGE_QUEUE, space, canvasModel, computeModel);
|
|
@@ -114,7 +236,7 @@ export const generator = () => ({
|
|
|
114
236
|
const objects = range(n, () => {
|
|
115
237
|
const { canvasModel, computeModel } = createQueueSinkPreset(
|
|
116
238
|
space,
|
|
117
|
-
|
|
239
|
+
'timer',
|
|
118
240
|
(triggerSpec) => (triggerSpec.cron = '*/5 * * * * *'),
|
|
119
241
|
'result',
|
|
120
242
|
);
|
|
@@ -125,72 +247,73 @@ export const generator = () => ({
|
|
|
125
247
|
},
|
|
126
248
|
],
|
|
127
249
|
|
|
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
|
-
|
|
250
|
+
// TODO(wittjosiah): Remove?
|
|
251
|
+
// [
|
|
252
|
+
// PresetName.EMAIL_TABLE,
|
|
253
|
+
// async (space, n, cb) => {
|
|
254
|
+
// const objects = range(n, () => {
|
|
255
|
+
// const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
256
|
+
|
|
257
|
+
// const results = space.db.query(Filter.type(TableType)).runSync();
|
|
258
|
+
// const emailTable = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Email'));
|
|
259
|
+
// invariant(emailTable, 'Email table not found.');
|
|
260
|
+
|
|
261
|
+
// const template = canvasModel.createNode(
|
|
262
|
+
// createTemplate({
|
|
263
|
+
// valueType: 'object',
|
|
264
|
+
// ...rawPosition({ centerX: -80, centerY: -64, width: 320, height: 320 }),
|
|
265
|
+
// }),
|
|
266
|
+
// );
|
|
267
|
+
// const templateContent = ['{'];
|
|
268
|
+
|
|
269
|
+
// let functionTrigger: FunctionTrigger | undefined;
|
|
270
|
+
// canvasModel.builder.call((builder) => {
|
|
271
|
+
// const triggerShape = createTrigger({
|
|
272
|
+
// spaceId: space.id,
|
|
273
|
+
// triggerKind: 'email',
|
|
274
|
+
// ...position({ x: -18, y: -2 }),
|
|
275
|
+
// });
|
|
276
|
+
// const trigger = canvasModel.createNode(triggerShape);
|
|
277
|
+
|
|
278
|
+
// const tableId = canvasModel.createNode(
|
|
279
|
+
// createConstant({
|
|
280
|
+
// value: DXN.fromLocalObjectId(emailTable.id).toString(),
|
|
281
|
+
// ...position({ x: -18, y: 5, width: 8, height: 6 }),
|
|
282
|
+
// }),
|
|
283
|
+
// );
|
|
284
|
+
|
|
285
|
+
// const appendToTable = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
|
|
286
|
+
|
|
287
|
+
// const properties = SchemaAST.getPropertySignatures(EmailTriggerOutput.ast);
|
|
288
|
+
// for (let i = 0; i < properties.length; i++) {
|
|
289
|
+
// const propName = properties[i].name.toString();
|
|
290
|
+
// builder.createEdge({ source: trigger.id, target: template.id, input: propName, output: propName });
|
|
291
|
+
// templateContent.push(` "${propName}": "{{${propName}}}"` + (i === properties.length - 1 ? '' : ','));
|
|
292
|
+
// }
|
|
293
|
+
// templateContent.push('}');
|
|
294
|
+
|
|
295
|
+
// builder
|
|
296
|
+
// .createEdge({ source: tableId.id, target: appendToTable.id, input: 'id' })
|
|
297
|
+
// .createEdge({ source: template.id, target: appendToTable.id, input: 'items' });
|
|
298
|
+
|
|
299
|
+
// functionTrigger = triggerShape.functionTrigger!.target!;
|
|
300
|
+
// });
|
|
301
|
+
|
|
302
|
+
// const computeModel = createComputeGraph(canvasModel);
|
|
303
|
+
|
|
304
|
+
// const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
305
|
+
// invariant(templateComputeNode, 'Template compute node was not created.');
|
|
306
|
+
// templateComputeNode.value = templateContent.join('\n');
|
|
307
|
+
// templateComputeNode.inputSchema = Type.toJsonSchema(EmailTriggerOutput);
|
|
308
|
+
|
|
309
|
+
// attachTrigger(functionTrigger, computeModel);
|
|
310
|
+
|
|
311
|
+
// return addToSpace(PresetName.EMAIL_TABLE, space, canvasModel, computeModel);
|
|
312
|
+
// });
|
|
313
|
+
// cb?.(objects);
|
|
314
|
+
// return objects;
|
|
315
|
+
// },
|
|
316
|
+
// ],
|
|
194
317
|
|
|
195
318
|
[
|
|
196
319
|
PresetName.CHAT_GPT,
|
|
@@ -222,99 +345,100 @@ export const generator = () => ({
|
|
|
222
345
|
},
|
|
223
346
|
],
|
|
224
347
|
|
|
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
|
-
|
|
348
|
+
// TODO(wittjosiah): Remove?
|
|
349
|
+
// [
|
|
350
|
+
// PresetName.EMAIL_WITH_SUMMARY,
|
|
351
|
+
// async (space, n, cb) => {
|
|
352
|
+
// const objects = range(n, () => {
|
|
353
|
+
// const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
354
|
+
|
|
355
|
+
// const results = space.db.query(Filter.type(TableType)).runSync();
|
|
356
|
+
// const emailTable = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Email'));
|
|
357
|
+
// invariant(emailTable, 'Email table not found.');
|
|
358
|
+
|
|
359
|
+
// const template = canvasModel.createNode(
|
|
360
|
+
// createTemplate({
|
|
361
|
+
// valueType: 'object',
|
|
362
|
+
// ...rawPosition({ centerX: 192, centerY: -176, width: 320, height: 320 }),
|
|
363
|
+
// }),
|
|
364
|
+
// );
|
|
365
|
+
// const templateContent = ['{'];
|
|
366
|
+
|
|
367
|
+
// let functionTrigger: FunctionTrigger | undefined;
|
|
368
|
+
// canvasModel.builder.call((builder) => {
|
|
369
|
+
// const gpt = canvasModel.createNode(
|
|
370
|
+
// createGpt(rawPosition({ centerX: -400, centerY: -112, width: 256, height: 202 })),
|
|
371
|
+
// );
|
|
372
|
+
// const systemPrompt = canvasModel.createNode(
|
|
373
|
+
// createConstant({
|
|
374
|
+
// value: "use one word to describe content category. don't write anything else",
|
|
375
|
+
// ...rawPosition({ centerX: -800, centerY: -160, width: 192, height: 128 }),
|
|
376
|
+
// }),
|
|
377
|
+
// );
|
|
378
|
+
// const triggerShape = createTrigger({
|
|
379
|
+
// spaceId: space.id,
|
|
380
|
+
// triggerKind: 'email',
|
|
381
|
+
// ...rawPosition({ centerX: -736, centerY: -384, width: 182, height: 192 }),
|
|
382
|
+
// });
|
|
383
|
+
// const trigger = canvasModel.createNode(triggerShape);
|
|
384
|
+
|
|
385
|
+
// const { queueId } = setupQueue(space, canvasModel, {
|
|
386
|
+
// idPosition: { centerX: -720, centerY: 224, width: 192, height: 256 },
|
|
387
|
+
// queuePosition: { centerX: -144, centerY: 416, width: 320, height: 448 },
|
|
388
|
+
// });
|
|
389
|
+
// const appendToQueue = canvasModel.createNode(
|
|
390
|
+
// createAppend(rawPosition({ centerX: -80, centerY: 96, width: 122, height: 128 })),
|
|
391
|
+
// );
|
|
392
|
+
|
|
393
|
+
// const tableId = canvasModel.createNode(
|
|
394
|
+
// createConstant({
|
|
395
|
+
// value: DXN.fromLocalObjectId(emailTable.id).toString(),
|
|
396
|
+
// ...rawPosition({ centerX: -112, centerY: -544, width: 192, height: 256 }),
|
|
397
|
+
// }),
|
|
398
|
+
// );
|
|
399
|
+
|
|
400
|
+
// const appendToTable = canvasModel.createNode(
|
|
401
|
+
// createAppend(rawPosition({ centerX: 560, centerY: -416, width: 128, height: 122 })),
|
|
402
|
+
// );
|
|
403
|
+
|
|
404
|
+
// templateContent.push(' "category": "{{text}}",');
|
|
405
|
+
// builder.createEdge({ source: gpt.id, target: template.id, input: 'text', output: 'text' });
|
|
406
|
+
|
|
407
|
+
// const properties = SchemaAST.getPropertySignatures(EmailTriggerOutput.ast);
|
|
408
|
+
// for (let i = 0; i < properties.length; i++) {
|
|
409
|
+
// const propName = properties[i].name.toString();
|
|
410
|
+
// builder.createEdge({ source: trigger.id, target: template.id, input: propName, output: propName });
|
|
411
|
+
// templateContent.push(` "${propName}": "{{${propName}}}"` + (i === properties.length - 1 ? '' : ','));
|
|
412
|
+
// }
|
|
413
|
+
// templateContent.push('}');
|
|
414
|
+
|
|
415
|
+
// builder
|
|
416
|
+
// .createEdge({ source: tableId.id, target: appendToTable.id, input: 'id' })
|
|
417
|
+
// .createEdge({ source: queueId.id, target: appendToQueue.id, input: 'id' })
|
|
418
|
+
// .createEdge({ source: gpt.id, target: appendToQueue.id, output: 'messages', input: 'items' })
|
|
419
|
+
// .createEdge({ source: systemPrompt.id, target: gpt.id, input: 'systemPrompt' })
|
|
420
|
+
// .createEdge({ source: trigger.id, target: gpt.id, input: 'prompt', output: 'body' })
|
|
421
|
+
// .createEdge({ source: template.id, target: appendToTable.id, input: 'items' });
|
|
422
|
+
|
|
423
|
+
// functionTrigger = triggerShape.functionTrigger!.target!;
|
|
424
|
+
// });
|
|
425
|
+
|
|
426
|
+
// const computeModel = createComputeGraph(canvasModel);
|
|
427
|
+
|
|
428
|
+
// const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
429
|
+
// invariant(templateComputeNode, 'Template compute node was not created.');
|
|
430
|
+
// templateComputeNode.value = templateContent.join('\n');
|
|
431
|
+
// const extendedSchema = Schema.extend(EmailTriggerOutput, Schema.Struct({ text: Schema.String }));
|
|
432
|
+
// templateComputeNode.inputSchema = Type.toJsonSchema(extendedSchema);
|
|
433
|
+
|
|
434
|
+
// attachTrigger(functionTrigger, computeModel);
|
|
435
|
+
|
|
436
|
+
// return addToSpace(PresetName.EMAIL_WITH_SUMMARY, space, canvasModel, computeModel);
|
|
437
|
+
// });
|
|
438
|
+
// cb?.(objects);
|
|
439
|
+
// return objects;
|
|
440
|
+
// },
|
|
441
|
+
// ],
|
|
318
442
|
|
|
319
443
|
[
|
|
320
444
|
PresetName.FOREX_FUNCTION_CALL,
|
|
@@ -357,7 +481,7 @@ export const generator = () => ({
|
|
|
357
481
|
canvasModel.builder.call((builder) => {
|
|
358
482
|
const triggerShape = createTrigger({
|
|
359
483
|
spaceId: space.id,
|
|
360
|
-
triggerKind:
|
|
484
|
+
triggerKind: 'timer',
|
|
361
485
|
...position({ x: -10, y: -5 }),
|
|
362
486
|
});
|
|
363
487
|
const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -395,54 +519,55 @@ export const generator = () => ({
|
|
|
395
519
|
},
|
|
396
520
|
],
|
|
397
521
|
|
|
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
|
-
|
|
522
|
+
// TODO(wittjosiah): Remove?
|
|
523
|
+
// [
|
|
524
|
+
// PresetName.KANBAN_QUEUE,
|
|
525
|
+
// async (space, n, cb) => {
|
|
526
|
+
// const objects = range(n, () => {
|
|
527
|
+
// const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
528
|
+
|
|
529
|
+
// // TODO(wittjosiah): Integrate directly w/ Kanban.
|
|
530
|
+
// // const results = space.db.query(Filter.type(KanbanType)).runSync();
|
|
531
|
+
// // const kanban = results.find((r) => r.object?.cardView?.target?.query?.type?.endsWith('Message'));
|
|
532
|
+
// // invariant(kanban, 'Kanban not found.');
|
|
533
|
+
|
|
534
|
+
// const results = space.db.query(Filter.type(TableType)).runSync();
|
|
535
|
+
// const messages = results.find((r) => r.object?.view?.target?.query?.typename?.endsWith('Message'));
|
|
536
|
+
// invariant(messages, 'Table not found.');
|
|
537
|
+
|
|
538
|
+
// let functionTrigger: FunctionTrigger | undefined;
|
|
539
|
+
// canvasModel.builder.call((builder) => {
|
|
540
|
+
// const triggerShape = createTrigger({
|
|
541
|
+
// spaceId: space.id,
|
|
542
|
+
// triggerKind: 'queue',
|
|
543
|
+
// ...position({ x: -10, y: -5 }),
|
|
544
|
+
// });
|
|
545
|
+
// const trigger = canvasModel.createNode(triggerShape);
|
|
546
|
+
|
|
547
|
+
// const tableId = canvasModel.createNode(
|
|
548
|
+
// createConstant({
|
|
549
|
+
// value: DXN.fromLocalObjectId(messages.id).toString(),
|
|
550
|
+
// ...position({ x: -10, y: 5 }),
|
|
551
|
+
// }),
|
|
552
|
+
// );
|
|
553
|
+
// const appendToTable = canvasModel.createNode(createAppend(position({ x: 10, y: 0 })));
|
|
554
|
+
|
|
555
|
+
// builder
|
|
556
|
+
// .createEdge({ source: tableId.id, target: appendToTable.id, input: 'id' })
|
|
557
|
+
// .createEdge({ source: trigger.id, target: appendToTable.id, input: 'items', output: 'item' });
|
|
558
|
+
|
|
559
|
+
// functionTrigger = triggerShape.functionTrigger!.target!;
|
|
560
|
+
// });
|
|
561
|
+
|
|
562
|
+
// const computeModel = createComputeGraph(canvasModel);
|
|
563
|
+
// attachTrigger(functionTrigger, computeModel);
|
|
564
|
+
|
|
565
|
+
// return addToSpace(PresetName.KANBAN_QUEUE, space, canvasModel, computeModel);
|
|
566
|
+
// });
|
|
567
|
+
// cb?.(objects);
|
|
568
|
+
// return objects;
|
|
569
|
+
// },
|
|
570
|
+
// ],
|
|
446
571
|
] as [PresetName, ObjectGenerator<any>][],
|
|
447
572
|
});
|
|
448
573
|
|