@dxos/plugin-debug 0.8.4-main.3eb6e50203 → 0.8.4-main.4a85c3132b
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 → DebugGraph-7HXJ2PS2.mjs} +4 -3
- package/dist/lib/browser/{DebugGraph-6VMEOKEV.mjs.map → DebugGraph-7HXJ2PS2.mjs.map} +4 -4
- package/dist/lib/browser/DebugObjectPanel-3TCDNUNW.mjs +33 -0
- package/dist/lib/browser/DebugObjectPanel-3TCDNUNW.mjs.map +7 -0
- package/dist/lib/browser/DebugSettings-JZMIUDYB.mjs +174 -0
- package/dist/lib/browser/DebugSettings-JZMIUDYB.mjs.map +7 -0
- package/dist/lib/browser/DebugSpaceObjectsPanel-7NRPLWZ4.mjs +50 -0
- package/dist/lib/browser/DebugSpaceObjectsPanel-7NRPLWZ4.mjs.map +7 -0
- package/dist/lib/browser/DebugStatus-COQGH37G.mjs +125 -0
- package/dist/lib/browser/DebugStatus-COQGH37G.mjs.map +7 -0
- package/dist/lib/browser/{DevtoolsOverviewContainer-2C6XMJ3L.mjs → DevtoolsOverviewContainer-C75NFVER.mjs} +4 -3
- package/dist/lib/browser/{DevtoolsOverviewContainer-2C6XMJ3L.mjs.map → DevtoolsOverviewContainer-C75NFVER.mjs.map} +4 -4
- package/dist/lib/browser/{SpaceGenerator-W3LJORYT.mjs → SpaceGenerator-SWSGJEEL.mjs} +293 -271
- package/dist/lib/browser/SpaceGenerator-SWSGJEEL.mjs.map +7 -0
- package/dist/lib/browser/Wireframe-KAGOKEFW.mjs +53 -0
- package/dist/lib/browser/Wireframe-KAGOKEFW.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-DEBTVBQG.mjs → app-graph-builder-LGUQNXHD.mjs} +28 -2
- package/dist/lib/browser/{app-graph-builder-DEBTVBQG.mjs.map → app-graph-builder-LGUQNXHD.mjs.map} +2 -2
- package/dist/lib/browser/index.mjs +12 -6
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-BTVNKKVQ.mjs +443 -0
- package/dist/lib/browser/react-surface-BTVNKKVQ.mjs.map +7 -0
- package/dist/types/src/DebugPlugin.d.ts +6 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context/react-context.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings/settings.d.ts +1 -1
- package/dist/types/src/components/SchemaTable/SchemaTable.d.ts.map +1 -0
- package/dist/types/src/components/SchemaTable/index.d.ts +2 -0
- package/dist/types/src/components/SchemaTable/index.d.ts.map +1 -0
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/index.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/index.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -10
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/{components → containers/DebugGraph}/DebugGraph.d.ts +0 -1
- package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts.map +1 -0
- package/dist/types/src/containers/DebugGraph/index.d.ts +3 -0
- package/dist/types/src/containers/DebugGraph/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/DebugObjectPanel}/DebugObjectPanel.d.ts +1 -1
- package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -0
- package/dist/types/src/containers/DebugObjectPanel/index.d.ts +3 -0
- package/dist/types/src/containers/DebugObjectPanel/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/DebugSettings}/DebugSettings.d.ts +4 -2
- package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts.map +1 -0
- package/dist/types/src/containers/DebugSettings/index.d.ts +3 -0
- package/dist/types/src/containers/DebugSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +3 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts +3 -0
- package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts.map +1 -0
- package/dist/types/src/containers/DebugStatus/index.d.ts +3 -0
- package/dist/types/src/containers/DebugStatus/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/DevtoolsOverviewContainer}/DevtoolsOverviewContainer.d.ts +0 -1
- package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts.map +1 -0
- package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts +3 -0
- package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/containers/SpaceGenerator/index.d.ts +3 -0
- package/dist/types/src/containers/SpaceGenerator/index.d.ts.map +1 -0
- package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -0
- package/dist/types/src/containers/Wireframe/index.d.ts +3 -0
- package/dist/types/src/containers/Wireframe/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +10 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +58 -59
- package/src/DebugPlugin.tsx +13 -3
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +21 -1
- package/src/capabilities/react-surface/react-surface.tsx +27 -10
- package/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.tsx +2 -2
- package/src/components/SchemaTable/index.ts +5 -0
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +3 -2
- package/src/components/SpaceGenerator/index.ts +2 -3
- package/src/components/SpaceGenerator/presets.ts +32 -24
- package/src/components/index.ts +2 -13
- package/src/{components → containers/DebugGraph}/DebugGraph.tsx +0 -2
- package/src/containers/DebugGraph/index.ts +7 -0
- package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +45 -0
- package/src/containers/DebugObjectPanel/index.ts +7 -0
- package/src/{components → containers/DebugSettings}/DebugSettings.tsx +20 -4
- package/src/containers/DebugSettings/index.ts +7 -0
- package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +60 -0
- package/src/containers/DebugSpaceObjectsPanel/index.ts +7 -0
- package/src/containers/DebugStatus/index.ts +7 -0
- package/src/{components → containers/DevtoolsOverviewContainer}/DevtoolsOverviewContainer.tsx +0 -2
- package/src/containers/DevtoolsOverviewContainer/index.ts +7 -0
- package/src/{components → containers}/SpaceGenerator/SpaceGenerator.tsx +35 -34
- package/src/containers/SpaceGenerator/index.ts +7 -0
- package/src/{components → containers/Wireframe}/Wireframe.tsx +2 -2
- package/src/containers/Wireframe/index.ts +7 -0
- package/src/containers/index.ts +14 -0
- package/src/translations.ts +2 -0
- package/dist/lib/browser/SpaceGenerator-W3LJORYT.mjs.map +0 -7
- package/dist/lib/browser/react-surface-FMVC5GPV.mjs +0 -758
- package/dist/lib/browser/react-surface-FMVC5GPV.mjs.map +0 -7
- package/dist/types/src/components/Container.d.ts +0 -5
- package/dist/types/src/components/Container.d.ts.map +0 -1
- package/dist/types/src/components/DebugGraph.d.ts.map +0 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +0 -1
- package/dist/types/src/components/DebugSettings.d.ts.map +0 -1
- package/dist/types/src/components/DebugStatus.d.ts.map +0 -1
- package/dist/types/src/components/DevtoolsOverviewContainer.d.ts.map +0 -1
- package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +0 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +0 -15
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +0 -1
- package/dist/types/src/components/Wireframe.d.ts.map +0 -1
- package/src/components/Container.tsx +0 -15
- package/src/components/DebugObjectPanel.tsx +0 -32
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +0 -54
- /package/dist/types/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.d.ts +0 -0
- /package/dist/types/src/{components → containers/DebugStatus}/DebugStatus.d.ts +0 -0
- /package/dist/types/src/{components → containers}/SpaceGenerator/SpaceGenerator.d.ts +0 -0
- /package/dist/types/src/{components → containers/Wireframe}/Wireframe.d.ts +0 -0
- /package/src/{components → containers/DebugStatus}/DebugStatus.tsx +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/containers/SpaceGenerator/SpaceGenerator.tsx
|
|
2
2
|
import React2, { useCallback, useMemo, useState } from "react";
|
|
3
3
|
import { useOperationInvoker } from "@dxos/app-framework/ui";
|
|
4
4
|
import { ComputeGraph as ComputeGraph2 } from "@dxos/conductor";
|
|
@@ -7,208 +7,51 @@ import { Markdown as Markdown3 } from "@dxos/plugin-markdown/types";
|
|
|
7
7
|
import { Sheet as Sheet2 } from "@dxos/plugin-sheet/types";
|
|
8
8
|
import { Diagram as Diagram2 } from "@dxos/plugin-sketch/types";
|
|
9
9
|
import { useClient } from "@dxos/react-client";
|
|
10
|
-
import { IconButton as IconButton2, Input,
|
|
10
|
+
import { IconButton as IconButton2, Input, Panel, ScrollArea, Toolbar, useAsyncEffect } from "@dxos/react-ui";
|
|
11
11
|
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
12
12
|
import { Organization as Organization2, Person as Person2, Task } from "@dxos/types";
|
|
13
13
|
import { jsonKeyReplacer, sortKeys } from "@dxos/util";
|
|
14
14
|
|
|
15
|
-
// src/components/
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
typename
|
|
38
|
-
}).runSync()[0];
|
|
39
|
-
if (!view && !staticSchema) {
|
|
40
|
-
await invokePromise(SpaceOperation.AddSchema, {
|
|
41
|
-
db: space.db,
|
|
42
|
-
schema,
|
|
43
|
-
show: false
|
|
44
|
-
});
|
|
45
|
-
} else if (!view && staticSchema) {
|
|
46
|
-
await invokePromise(SpaceOperation.UseStaticSchema, {
|
|
47
|
-
db: space.db,
|
|
48
|
-
typename,
|
|
49
|
-
show: false
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
const generate = createAsyncGenerator(generator, schema, {
|
|
53
|
-
db: space.db
|
|
54
|
-
});
|
|
55
|
-
return generate.createObjects(n);
|
|
56
|
-
};
|
|
15
|
+
// src/components/SchemaTable/SchemaTable.tsx
|
|
16
|
+
import React from "react";
|
|
17
|
+
import { IconButton } from "@dxos/react-ui";
|
|
18
|
+
var SchemaTable = ({ types, objects = {}, label, onClick }) => {
|
|
19
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
20
|
+
className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
|
|
21
|
+
}, /* @__PURE__ */ React.createElement("h2", {
|
|
22
|
+
className: "p-2"
|
|
23
|
+
}, label), types.map((type) => /* @__PURE__ */ React.createElement("div", {
|
|
24
|
+
key: type.typename,
|
|
25
|
+
className: "grid grid-cols-subgrid col-span-3 items-center"
|
|
26
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
27
|
+
className: "px-2 text-sm font-mono text-subdued"
|
|
28
|
+
}, type.typename), /* @__PURE__ */ React.createElement("div", {
|
|
29
|
+
className: "px-2 text-right font-mono"
|
|
30
|
+
}, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
|
|
31
|
+
variant: "ghost",
|
|
32
|
+
icon: "ph--plus--regular",
|
|
33
|
+
iconOnly: true,
|
|
34
|
+
label: "Create data",
|
|
35
|
+
onClick: () => onClick(type.typename)
|
|
36
|
+
}))));
|
|
57
37
|
};
|
|
58
|
-
var staticGenerators = /* @__PURE__ */ new Map([
|
|
59
|
-
[
|
|
60
|
-
Markdown.Document.typename,
|
|
61
|
-
async (space, n, cb) => {
|
|
62
|
-
const objects = range(n).map(() => {
|
|
63
|
-
return space.db.add(Markdown.make({
|
|
64
|
-
name: faker.commerce.productName(),
|
|
65
|
-
content: faker.lorem.sentences(5)
|
|
66
|
-
}));
|
|
67
|
-
});
|
|
68
|
-
cb?.(objects);
|
|
69
|
-
return objects;
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
|
-
[
|
|
73
|
-
Diagram.Diagram.typename,
|
|
74
|
-
async (space, n, cb) => {
|
|
75
|
-
const objects = range(n).map(() => {
|
|
76
|
-
const obj = space.db.add(Diagram.make({
|
|
77
|
-
name: faker.commerce.productName()
|
|
78
|
-
}));
|
|
79
|
-
return obj;
|
|
80
|
-
});
|
|
81
|
-
cb?.(objects);
|
|
82
|
-
return objects;
|
|
83
|
-
}
|
|
84
|
-
],
|
|
85
|
-
// TODO(burdon): Create unit tests.
|
|
86
|
-
[
|
|
87
|
-
Sheet.Sheet.typename,
|
|
88
|
-
async (space, n, cb) => {
|
|
89
|
-
const objects = range(n).map(() => {
|
|
90
|
-
const cells = {};
|
|
91
|
-
const year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
92
|
-
const cols = 4;
|
|
93
|
-
const rows = 16;
|
|
94
|
-
for (let col = 1; col <= cols; col++) {
|
|
95
|
-
for (let row = 1; row <= rows; row++) {
|
|
96
|
-
const cell = addressToA1Notation({
|
|
97
|
-
col,
|
|
98
|
-
row
|
|
99
|
-
});
|
|
100
|
-
if (row === 1) {
|
|
101
|
-
cells[cell] = {
|
|
102
|
-
value: `${year} Q${col}`
|
|
103
|
-
};
|
|
104
|
-
} else if (row === rows) {
|
|
105
|
-
const from = addressToA1Notation({
|
|
106
|
-
col,
|
|
107
|
-
row: 2
|
|
108
|
-
});
|
|
109
|
-
const to = addressToA1Notation({
|
|
110
|
-
col,
|
|
111
|
-
row: rows - 1
|
|
112
|
-
});
|
|
113
|
-
cells[cell] = {
|
|
114
|
-
value: `=SUM(${from}:${to})`
|
|
115
|
-
};
|
|
116
|
-
} else if (row > 2 && row < rows - 1) {
|
|
117
|
-
cells[cell] = {
|
|
118
|
-
value: Math.floor(Math.random() * 1e4)
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return space.db.add(Sheet.make({
|
|
124
|
-
name: faker.commerce.productName(),
|
|
125
|
-
cells
|
|
126
|
-
}));
|
|
127
|
-
});
|
|
128
|
-
cb?.(objects);
|
|
129
|
-
return objects;
|
|
130
|
-
}
|
|
131
|
-
],
|
|
132
|
-
[
|
|
133
|
-
ComputeGraph.typename,
|
|
134
|
-
async (space, n, cb) => {
|
|
135
|
-
const objects = range(n, () => {
|
|
136
|
-
const model = ComputeGraphModel.create();
|
|
137
|
-
model.builder.createNode({
|
|
138
|
-
id: "gpt-INPUT",
|
|
139
|
-
type: NODE_INPUT
|
|
140
|
-
}).createNode({
|
|
141
|
-
id: "gpt-GPT",
|
|
142
|
-
type: "gpt"
|
|
143
|
-
}).createNode({
|
|
144
|
-
id: "gpt-QUEUE_ID",
|
|
145
|
-
type: "constant",
|
|
146
|
-
value: new DXN(DXN.kind.QUEUE, [
|
|
147
|
-
"data",
|
|
148
|
-
space.id,
|
|
149
|
-
Key.ObjectId.random()
|
|
150
|
-
]).toString()
|
|
151
|
-
}).createNode({
|
|
152
|
-
id: "gpt-APPEND",
|
|
153
|
-
type: "append"
|
|
154
|
-
}).createNode({
|
|
155
|
-
id: "gpt-OUTPUT",
|
|
156
|
-
type: NODE_OUTPUT
|
|
157
|
-
}).createEdge({
|
|
158
|
-
node: "gpt-INPUT",
|
|
159
|
-
property: "prompt"
|
|
160
|
-
}, {
|
|
161
|
-
node: "gpt-GPT",
|
|
162
|
-
property: "prompt"
|
|
163
|
-
}).createEdge({
|
|
164
|
-
node: "gpt-GPT",
|
|
165
|
-
property: "text"
|
|
166
|
-
}, {
|
|
167
|
-
node: "gpt-OUTPUT",
|
|
168
|
-
property: "text"
|
|
169
|
-
}).createEdge({
|
|
170
|
-
node: "gpt-QUEUE_ID",
|
|
171
|
-
property: DEFAULT_OUTPUT
|
|
172
|
-
}, {
|
|
173
|
-
node: "gpt-APPEND",
|
|
174
|
-
property: "id"
|
|
175
|
-
}).createEdge({
|
|
176
|
-
node: "gpt-GPT",
|
|
177
|
-
property: "messages"
|
|
178
|
-
}, {
|
|
179
|
-
node: "gpt-APPEND",
|
|
180
|
-
property: "items"
|
|
181
|
-
}).createEdge({
|
|
182
|
-
node: "gpt-QUEUE_ID",
|
|
183
|
-
property: DEFAULT_OUTPUT
|
|
184
|
-
}, {
|
|
185
|
-
node: "gpt-OUTPUT",
|
|
186
|
-
property: "queue"
|
|
187
|
-
});
|
|
188
|
-
return space.db.add(model.root);
|
|
189
|
-
});
|
|
190
|
-
cb?.(objects);
|
|
191
|
-
return objects;
|
|
192
|
-
}
|
|
193
|
-
]
|
|
194
|
-
]);
|
|
195
38
|
|
|
196
39
|
// src/components/SpaceGenerator/presets.ts
|
|
197
40
|
import * as Schema from "effect/Schema";
|
|
198
|
-
import {
|
|
41
|
+
import { AgentFunctions, EntityExtractionFunctions, ResearchBlueprint } from "@dxos/assistant-toolkit";
|
|
199
42
|
import { Prompt } from "@dxos/blueprints";
|
|
200
|
-
import { NODE_INPUT
|
|
201
|
-
import { DXN
|
|
43
|
+
import { NODE_INPUT } from "@dxos/conductor";
|
|
44
|
+
import { DXN, Feed, Filter, JsonSchema, Key, Obj, Query, Ref, Tag } from "@dxos/echo";
|
|
202
45
|
import { Trigger, serializeFunction } from "@dxos/functions";
|
|
203
46
|
import { invariant } from "@dxos/invariant";
|
|
204
|
-
import {
|
|
47
|
+
import { GmailFunctions } from "@dxos/plugin-inbox";
|
|
205
48
|
import { Mailbox } from "@dxos/plugin-inbox/types";
|
|
206
|
-
import { Markdown
|
|
49
|
+
import { Markdown } from "@dxos/plugin-markdown/types";
|
|
207
50
|
import { createAppend, createChat, createComputeGraph, createConstant, createFunction, createGpt, createQueue, createRandom, createSurface, createTemplate, createText, createTrigger } from "@dxos/react-ui-canvas-compute";
|
|
208
51
|
import { CanvasBoard, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from "@dxos/react-ui-canvas-editor";
|
|
209
|
-
import {
|
|
52
|
+
import { ViewModel } from "@dxos/schema";
|
|
210
53
|
import { Message, Organization, Person, Pipeline } from "@dxos/types";
|
|
211
|
-
import { range
|
|
54
|
+
import { range, trim } from "@dxos/util";
|
|
212
55
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-debug/src/components/SpaceGenerator/presets.ts";
|
|
213
56
|
var PresetName = /* @__PURE__ */ (function(PresetName2) {
|
|
214
57
|
PresetName2["DXOS_TEAM"] = "dxos-team";
|
|
@@ -221,7 +64,7 @@ var PresetName = /* @__PURE__ */ (function(PresetName2) {
|
|
|
221
64
|
PresetName2["DISCORD_MESSAGES"] = "discord-messages";
|
|
222
65
|
return PresetName2;
|
|
223
66
|
})({});
|
|
224
|
-
var
|
|
67
|
+
var generator = () => ({
|
|
225
68
|
schemas: [
|
|
226
69
|
CanvasBoard.CanvasBoard,
|
|
227
70
|
Trigger.Trigger
|
|
@@ -233,12 +76,12 @@ var generator2 = () => ({
|
|
|
233
76
|
[
|
|
234
77
|
"dxos-team",
|
|
235
78
|
async (space, n, cb) => {
|
|
236
|
-
const objects =
|
|
79
|
+
const objects = range(n, () => {
|
|
237
80
|
const org = space.db.add(Obj.make(Organization.Organization, {
|
|
238
81
|
name: "DXOS",
|
|
239
82
|
website: "https://dxos.org"
|
|
240
83
|
}));
|
|
241
|
-
const doc = space.db.add(
|
|
84
|
+
const doc = space.db.add(Markdown.make({
|
|
242
85
|
name: "DXOS Research",
|
|
243
86
|
content: "DXOS builds Composer, an open-source AI-powered malleable application."
|
|
244
87
|
}));
|
|
@@ -252,12 +95,13 @@ var generator2 = () => ({
|
|
|
252
95
|
];
|
|
253
96
|
});
|
|
254
97
|
space.db.add(Obj.make(Person.Person, {
|
|
98
|
+
[Obj.Meta]: {
|
|
99
|
+
tags: [
|
|
100
|
+
tagDxn
|
|
101
|
+
]
|
|
102
|
+
},
|
|
255
103
|
fullName: "Rich",
|
|
256
104
|
organization: Ref.make(org)
|
|
257
|
-
}, {
|
|
258
|
-
tags: [
|
|
259
|
-
tagDxn
|
|
260
|
-
]
|
|
261
105
|
}));
|
|
262
106
|
space.db.add(Obj.make(Person.Person, {
|
|
263
107
|
fullName: "Josiah",
|
|
@@ -280,22 +124,42 @@ var generator2 = () => ({
|
|
|
280
124
|
[
|
|
281
125
|
"org-research-project",
|
|
282
126
|
async (space, n, cb) => {
|
|
283
|
-
const
|
|
284
|
-
const
|
|
127
|
+
const feeds = await space.db.query(Filter.type(Feed.Feed)).run();
|
|
128
|
+
const mailbox = feeds.find((feed) => feed.kind === Mailbox.kind);
|
|
129
|
+
invariant(mailbox, "Mailbox feed not found", {
|
|
130
|
+
F: __dxlog_file,
|
|
131
|
+
L: 121,
|
|
132
|
+
S: void 0,
|
|
133
|
+
A: [
|
|
134
|
+
"mailbox",
|
|
135
|
+
"'Mailbox feed not found'"
|
|
136
|
+
]
|
|
137
|
+
});
|
|
138
|
+
const queueDxn = Feed.getQueueDxn(mailbox)?.toString();
|
|
139
|
+
invariant(queueDxn, "Mailbox feed missing queue DXN key", {
|
|
140
|
+
F: __dxlog_file,
|
|
141
|
+
L: 123,
|
|
142
|
+
S: void 0,
|
|
143
|
+
A: [
|
|
144
|
+
"queueDxn",
|
|
145
|
+
"'Mailbox feed missing queue DXN key'"
|
|
146
|
+
]
|
|
147
|
+
});
|
|
148
|
+
const tag = await space.db.query(Filter.type(Tag.Tag, {
|
|
285
149
|
label: "Investor"
|
|
286
150
|
})).first();
|
|
287
151
|
const tagDxn = Obj.getDXN(tag).toString();
|
|
288
|
-
const objects =
|
|
289
|
-
const contactsQuery = Query.select(
|
|
290
|
-
const organizationsQuery = Query.select(
|
|
291
|
-
const notesQuery = Query.select(
|
|
152
|
+
const objects = range(n, () => {
|
|
153
|
+
const contactsQuery = Query.select(Filter.type(Person.Person)).select(Filter.tag(tagDxn));
|
|
154
|
+
const organizationsQuery = Query.select(Filter.type(Organization.Organization)).select(Filter.tag(tagDxn));
|
|
155
|
+
const notesQuery = Query.select(Filter.type(Markdown.Document)).select(Filter.tag(tagDxn));
|
|
292
156
|
space.db.add(Trigger.make({
|
|
293
157
|
enabled: true,
|
|
294
158
|
spec: {
|
|
295
159
|
kind: "timer",
|
|
296
160
|
cron: "* * * * *"
|
|
297
161
|
},
|
|
298
|
-
function: Ref.make(serializeFunction(
|
|
162
|
+
function: Ref.make(serializeFunction(GmailFunctions.Sync)),
|
|
299
163
|
input: {
|
|
300
164
|
mailbox: Ref.make(mailbox)
|
|
301
165
|
}
|
|
@@ -305,9 +169,9 @@ var generator2 = () => ({
|
|
|
305
169
|
// TODO(wittjosiah): Queue trigger doesn't support matching query of the column.
|
|
306
170
|
spec: {
|
|
307
171
|
kind: "queue",
|
|
308
|
-
queue:
|
|
172
|
+
queue: queueDxn
|
|
309
173
|
},
|
|
310
|
-
function: Ref.make(serializeFunction(
|
|
174
|
+
function: Ref.make(serializeFunction(EntityExtractionFunctions.Extract)),
|
|
311
175
|
input: {
|
|
312
176
|
source: "{{event.item}}"
|
|
313
177
|
}
|
|
@@ -327,7 +191,7 @@ var generator2 = () => ({
|
|
|
327
191
|
NOTE: Do mocked reseach (set mockSearch to true).
|
|
328
192
|
`,
|
|
329
193
|
blueprints: [
|
|
330
|
-
Ref.make(ResearchBlueprint)
|
|
194
|
+
Ref.make(ResearchBlueprint.make())
|
|
331
195
|
]
|
|
332
196
|
}));
|
|
333
197
|
space.db.add(Trigger.make({
|
|
@@ -338,35 +202,35 @@ var generator2 = () => ({
|
|
|
338
202
|
ast: organizationsQuery.ast
|
|
339
203
|
}
|
|
340
204
|
},
|
|
341
|
-
function: Ref.make(serializeFunction(
|
|
205
|
+
function: Ref.make(serializeFunction(AgentFunctions.Prompt)),
|
|
342
206
|
input: {
|
|
343
207
|
prompt: Ref.make(researchPrompt),
|
|
344
208
|
input: "{{event.subject}}"
|
|
345
209
|
}
|
|
346
210
|
}));
|
|
347
|
-
const mailboxView =
|
|
348
|
-
query: Query.select(
|
|
211
|
+
const mailboxView = ViewModel.make({
|
|
212
|
+
query: Query.select(Filter.type(Message.Message, {
|
|
349
213
|
properties: {
|
|
350
|
-
labels:
|
|
214
|
+
labels: Filter.contains("investor")
|
|
351
215
|
}
|
|
352
|
-
})).
|
|
216
|
+
})).from({
|
|
353
217
|
queues: [
|
|
354
|
-
|
|
218
|
+
queueDxn
|
|
355
219
|
]
|
|
356
220
|
}),
|
|
357
|
-
jsonSchema:
|
|
221
|
+
jsonSchema: JsonSchema.toJsonSchema(Message.Message)
|
|
358
222
|
});
|
|
359
|
-
const contactsView =
|
|
223
|
+
const contactsView = ViewModel.make({
|
|
360
224
|
query: contactsQuery,
|
|
361
|
-
jsonSchema:
|
|
225
|
+
jsonSchema: JsonSchema.toJsonSchema(Person.Person)
|
|
362
226
|
});
|
|
363
|
-
const organizationsView =
|
|
227
|
+
const organizationsView = ViewModel.make({
|
|
364
228
|
query: organizationsQuery,
|
|
365
|
-
jsonSchema:
|
|
229
|
+
jsonSchema: JsonSchema.toJsonSchema(Organization.Organization)
|
|
366
230
|
});
|
|
367
|
-
const notesView =
|
|
231
|
+
const notesView = ViewModel.make({
|
|
368
232
|
query: notesQuery,
|
|
369
|
-
jsonSchema:
|
|
233
|
+
jsonSchema: JsonSchema.toJsonSchema(Markdown.Document)
|
|
370
234
|
});
|
|
371
235
|
return space.db.add(Pipeline.make({
|
|
372
236
|
name: "Investor Research",
|
|
@@ -401,7 +265,7 @@ var generator2 = () => ({
|
|
|
401
265
|
[
|
|
402
266
|
"webhook-gpt-queue",
|
|
403
267
|
async (space, n, cb) => {
|
|
404
|
-
const objects =
|
|
268
|
+
const objects = range(n, () => {
|
|
405
269
|
const canvasModel = CanvasGraphModel.create();
|
|
406
270
|
let functionTrigger;
|
|
407
271
|
canvasModel.builder.call((builder) => {
|
|
@@ -461,9 +325,9 @@ var generator2 = () => ({
|
|
|
461
325
|
[
|
|
462
326
|
"objectChange-queue",
|
|
463
327
|
async (space, n, cb) => {
|
|
464
|
-
const objects =
|
|
328
|
+
const objects = range(n, () => {
|
|
465
329
|
const { canvasModel, computeModel } = createQueueSinkPreset(space, "subscription", (triggerSpec) => triggerSpec.query = {
|
|
466
|
-
ast: Query.select(
|
|
330
|
+
ast: Query.select(Filter.typename("dxos.org/type/Chess")).ast
|
|
467
331
|
}, "type");
|
|
468
332
|
return addToSpace("objectChange-queue", space, canvasModel, computeModel);
|
|
469
333
|
});
|
|
@@ -474,7 +338,7 @@ var generator2 = () => ({
|
|
|
474
338
|
[
|
|
475
339
|
"timerTick-queue",
|
|
476
340
|
async (space, n, cb) => {
|
|
477
|
-
const objects =
|
|
341
|
+
const objects = range(n, () => {
|
|
478
342
|
const { canvasModel, computeModel } = createQueueSinkPreset(space, "timer", (triggerSpec) => triggerSpec.cron = "*/5 * * * * *", "result");
|
|
479
343
|
return addToSpace("timerTick-queue", space, canvasModel, computeModel);
|
|
480
344
|
});
|
|
@@ -529,7 +393,7 @@ var generator2 = () => ({
|
|
|
529
393
|
// const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
530
394
|
// invariant(templateComputeNode, 'Template compute node was not created.');
|
|
531
395
|
// templateComputeNode.value = templateContent.join('\n');
|
|
532
|
-
// templateComputeNode.inputSchema =
|
|
396
|
+
// templateComputeNode.inputSchema = JsonSchema.toJsonSchema(EmailTriggerOutput);
|
|
533
397
|
// attachTrigger(functionTrigger, computeModel);
|
|
534
398
|
// return addToSpace(PresetName.EMAIL_TABLE, space, canvasModel, computeModel);
|
|
535
399
|
// });
|
|
@@ -540,7 +404,7 @@ var generator2 = () => ({
|
|
|
540
404
|
[
|
|
541
405
|
"chat-gpt-text",
|
|
542
406
|
async (space, n, cb) => {
|
|
543
|
-
const objects =
|
|
407
|
+
const objects = range(n, () => {
|
|
544
408
|
const canvasModel = CanvasGraphModel.create();
|
|
545
409
|
canvasModel.builder.call((builder) => {
|
|
546
410
|
const gpt = canvasModel.createNode(createGpt(position({
|
|
@@ -660,7 +524,7 @@ var generator2 = () => ({
|
|
|
660
524
|
// invariant(templateComputeNode, 'Template compute node was not created.');
|
|
661
525
|
// templateComputeNode.value = templateContent.join('\n');
|
|
662
526
|
// const extendedSchema = Schema.extend(EmailTriggerOutput, Schema.Struct({ text: Schema.String }));
|
|
663
|
-
// templateComputeNode.inputSchema =
|
|
527
|
+
// templateComputeNode.inputSchema = JsonSchema.toJsonSchema(extendedSchema);
|
|
664
528
|
// attachTrigger(functionTrigger, computeModel);
|
|
665
529
|
// return addToSpace(PresetName.EMAIL_WITH_SUMMARY, space, canvasModel, computeModel);
|
|
666
530
|
// });
|
|
@@ -671,7 +535,7 @@ var generator2 = () => ({
|
|
|
671
535
|
[
|
|
672
536
|
"forex-function-call",
|
|
673
537
|
async (space, n, cb) => {
|
|
674
|
-
const objects =
|
|
538
|
+
const objects = range(n, () => {
|
|
675
539
|
const canvasModel = CanvasGraphModel.create();
|
|
676
540
|
canvasModel.builder.call((builder) => {
|
|
677
541
|
const sourceCurrency = canvasModel.createNode(createConstant({
|
|
@@ -720,7 +584,7 @@ var generator2 = () => ({
|
|
|
720
584
|
[
|
|
721
585
|
"discord-messages",
|
|
722
586
|
async (space, n, cb) => {
|
|
723
|
-
const objects =
|
|
587
|
+
const objects = range(n, () => {
|
|
724
588
|
const canvasModel = CanvasGraphModel.create();
|
|
725
589
|
let functionTrigger;
|
|
726
590
|
canvasModel.builder.call((builder) => {
|
|
@@ -741,10 +605,10 @@ var generator2 = () => ({
|
|
|
741
605
|
})
|
|
742
606
|
}));
|
|
743
607
|
const queueId = canvasModel.createNode(createConstant({
|
|
744
|
-
value: new
|
|
608
|
+
value: new DXN(DXN.kind.QUEUE, [
|
|
745
609
|
"data",
|
|
746
610
|
space.id,
|
|
747
|
-
|
|
611
|
+
Key.ObjectId.random()
|
|
748
612
|
]).toString(),
|
|
749
613
|
...position({
|
|
750
614
|
x: -10,
|
|
@@ -862,7 +726,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
862
726
|
const triggerSpec = functionTrigger.spec;
|
|
863
727
|
invariant(triggerSpec && triggerSpec.kind === triggerKind, "No trigger spec.", {
|
|
864
728
|
F: __dxlog_file,
|
|
865
|
-
L:
|
|
729
|
+
L: 762,
|
|
866
730
|
S: void 0,
|
|
867
731
|
A: [
|
|
868
732
|
"triggerSpec && triggerSpec.kind === triggerKind",
|
|
@@ -877,7 +741,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
877
741
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
878
742
|
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
879
743
|
F: __dxlog_file,
|
|
880
|
-
L:
|
|
744
|
+
L: 771,
|
|
881
745
|
S: void 0,
|
|
882
746
|
A: [
|
|
883
747
|
"templateComputeNode",
|
|
@@ -890,7 +754,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
890
754
|
' "id": "@{{changeId}}"',
|
|
891
755
|
"}"
|
|
892
756
|
].join("\n");
|
|
893
|
-
templateComputeNode.inputSchema =
|
|
757
|
+
templateComputeNode.inputSchema = JsonSchema.toJsonSchema(Schema.Struct({
|
|
894
758
|
type: Schema.String,
|
|
895
759
|
changeId: Schema.String
|
|
896
760
|
}));
|
|
@@ -909,10 +773,10 @@ var addToSpace = (name, space, canvas, compute) => {
|
|
|
909
773
|
};
|
|
910
774
|
var setupQueue = (space, canvasModel, args) => {
|
|
911
775
|
const queueId = canvasModel.createNode(createConstant({
|
|
912
|
-
value: new
|
|
776
|
+
value: new DXN(DXN.kind.QUEUE, [
|
|
913
777
|
"data",
|
|
914
778
|
space.id,
|
|
915
|
-
|
|
779
|
+
Key.ObjectId.random()
|
|
916
780
|
]).toString(),
|
|
917
781
|
...args?.idPosition ? rawPosition(args.idPosition) : position({
|
|
918
782
|
x: -18,
|
|
@@ -939,14 +803,14 @@ var setupQueue = (space, canvasModel, args) => {
|
|
|
939
803
|
var attachTrigger = (functionTrigger, computeModel) => {
|
|
940
804
|
invariant(functionTrigger, void 0, {
|
|
941
805
|
F: __dxlog_file,
|
|
942
|
-
L:
|
|
806
|
+
L: 813,
|
|
943
807
|
S: void 0,
|
|
944
808
|
A: [
|
|
945
809
|
"functionTrigger",
|
|
946
810
|
""
|
|
947
811
|
]
|
|
948
812
|
});
|
|
949
|
-
const inputNode = computeModel.nodes.find((node) => node.type ===
|
|
813
|
+
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT);
|
|
950
814
|
Obj.change(functionTrigger, (t) => {
|
|
951
815
|
t.function = Ref.make(computeModel.root);
|
|
952
816
|
t.inputNodeId = inputNode.id;
|
|
@@ -996,31 +860,189 @@ var position = (rect) => {
|
|
|
996
860
|
}
|
|
997
861
|
};
|
|
998
862
|
|
|
999
|
-
// src/components/SpaceGenerator/
|
|
1000
|
-
import
|
|
1001
|
-
import {
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
variant: "ghost",
|
|
1016
|
-
icon: "ph--plus--regular",
|
|
1017
|
-
iconOnly: true,
|
|
1018
|
-
label: "Create data",
|
|
1019
|
-
onClick: () => onClick(type.typename)
|
|
1020
|
-
}))));
|
|
863
|
+
// src/components/SpaceGenerator/ObjectGenerator.tsx
|
|
864
|
+
import { addressToA1Notation } from "@dxos/compute";
|
|
865
|
+
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT as NODE_INPUT2, NODE_OUTPUT } from "@dxos/conductor";
|
|
866
|
+
import { DXN as DXN2, Filter as Filter2, Key as Key2 } from "@dxos/echo";
|
|
867
|
+
import { View } from "@dxos/echo";
|
|
868
|
+
import { Markdown as Markdown2 } from "@dxos/plugin-markdown/types";
|
|
869
|
+
import { Sheet } from "@dxos/plugin-sheet/types";
|
|
870
|
+
import { Diagram } from "@dxos/plugin-sketch/types";
|
|
871
|
+
import { SpaceOperation } from "@dxos/plugin-space/types";
|
|
872
|
+
import { faker } from "@dxos/random";
|
|
873
|
+
import { getTypenameFromQuery } from "@dxos/schema";
|
|
874
|
+
import { createAsyncGenerator } from "@dxos/schema/testing";
|
|
875
|
+
import { range as range2 } from "@dxos/util";
|
|
876
|
+
var generator2 = faker;
|
|
877
|
+
var findViewByTypename = async (views, typename) => {
|
|
878
|
+
return views.find((view) => getTypenameFromQuery(view.query.ast) === typename);
|
|
1021
879
|
};
|
|
880
|
+
var createGenerator = (client, invokePromise, schema) => {
|
|
881
|
+
return async (space, n) => {
|
|
882
|
+
const typename = schema.typename;
|
|
883
|
+
const views = await space.db.query(Filter2.type(View.View)).run();
|
|
884
|
+
const view = await findViewByTypename(views, typename);
|
|
885
|
+
const staticSchema = client?.graph.schemaRegistry.query({
|
|
886
|
+
typename
|
|
887
|
+
}).runSync()[0];
|
|
888
|
+
if (!view && !staticSchema) {
|
|
889
|
+
await invokePromise(SpaceOperation.AddSchema, {
|
|
890
|
+
db: space.db,
|
|
891
|
+
schema,
|
|
892
|
+
show: false
|
|
893
|
+
});
|
|
894
|
+
} else if (!view && staticSchema) {
|
|
895
|
+
await invokePromise(SpaceOperation.UseStaticSchema, {
|
|
896
|
+
db: space.db,
|
|
897
|
+
typename,
|
|
898
|
+
show: false
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
const generate = createAsyncGenerator(generator2, schema, {
|
|
902
|
+
db: space.db
|
|
903
|
+
});
|
|
904
|
+
return generate.createObjects(n);
|
|
905
|
+
};
|
|
906
|
+
};
|
|
907
|
+
var staticGenerators = /* @__PURE__ */ new Map([
|
|
908
|
+
[
|
|
909
|
+
Markdown2.Document.typename,
|
|
910
|
+
async (space, n, cb) => {
|
|
911
|
+
const objects = range2(n).map(() => {
|
|
912
|
+
return space.db.add(Markdown2.make({
|
|
913
|
+
name: faker.commerce.productName(),
|
|
914
|
+
content: faker.lorem.sentences(5)
|
|
915
|
+
}));
|
|
916
|
+
});
|
|
917
|
+
cb?.(objects);
|
|
918
|
+
return objects;
|
|
919
|
+
}
|
|
920
|
+
],
|
|
921
|
+
[
|
|
922
|
+
Diagram.Diagram.typename,
|
|
923
|
+
async (space, n, cb) => {
|
|
924
|
+
const objects = range2(n).map(() => {
|
|
925
|
+
const obj = space.db.add(Diagram.make({
|
|
926
|
+
name: faker.commerce.productName()
|
|
927
|
+
}));
|
|
928
|
+
return obj;
|
|
929
|
+
});
|
|
930
|
+
cb?.(objects);
|
|
931
|
+
return objects;
|
|
932
|
+
}
|
|
933
|
+
],
|
|
934
|
+
// TODO(burdon): Create unit tests.
|
|
935
|
+
[
|
|
936
|
+
Sheet.Sheet.typename,
|
|
937
|
+
async (space, n, cb) => {
|
|
938
|
+
const objects = range2(n).map(() => {
|
|
939
|
+
const cells = {};
|
|
940
|
+
const year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
941
|
+
const cols = 4;
|
|
942
|
+
const rows = 16;
|
|
943
|
+
for (let col = 1; col <= cols; col++) {
|
|
944
|
+
for (let row = 1; row <= rows; row++) {
|
|
945
|
+
const cell = addressToA1Notation({
|
|
946
|
+
col,
|
|
947
|
+
row
|
|
948
|
+
});
|
|
949
|
+
if (row === 1) {
|
|
950
|
+
cells[cell] = {
|
|
951
|
+
value: `${year} Q${col}`
|
|
952
|
+
};
|
|
953
|
+
} else if (row === rows) {
|
|
954
|
+
const from = addressToA1Notation({
|
|
955
|
+
col,
|
|
956
|
+
row: 2
|
|
957
|
+
});
|
|
958
|
+
const to = addressToA1Notation({
|
|
959
|
+
col,
|
|
960
|
+
row: rows - 1
|
|
961
|
+
});
|
|
962
|
+
cells[cell] = {
|
|
963
|
+
value: `=SUM(${from}:${to})`
|
|
964
|
+
};
|
|
965
|
+
} else if (row > 2 && row < rows - 1) {
|
|
966
|
+
cells[cell] = {
|
|
967
|
+
value: Math.floor(Math.random() * 1e4)
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
return space.db.add(Sheet.make({
|
|
973
|
+
name: faker.commerce.productName(),
|
|
974
|
+
cells
|
|
975
|
+
}));
|
|
976
|
+
});
|
|
977
|
+
cb?.(objects);
|
|
978
|
+
return objects;
|
|
979
|
+
}
|
|
980
|
+
],
|
|
981
|
+
[
|
|
982
|
+
ComputeGraph.typename,
|
|
983
|
+
async (space, n, cb) => {
|
|
984
|
+
const objects = range2(n, () => {
|
|
985
|
+
const model = ComputeGraphModel.create();
|
|
986
|
+
model.builder.createNode({
|
|
987
|
+
id: "gpt-INPUT",
|
|
988
|
+
type: NODE_INPUT2
|
|
989
|
+
}).createNode({
|
|
990
|
+
id: "gpt-GPT",
|
|
991
|
+
type: "gpt"
|
|
992
|
+
}).createNode({
|
|
993
|
+
id: "gpt-QUEUE_ID",
|
|
994
|
+
type: "constant",
|
|
995
|
+
value: new DXN2(DXN2.kind.QUEUE, [
|
|
996
|
+
"data",
|
|
997
|
+
space.id,
|
|
998
|
+
Key2.ObjectId.random()
|
|
999
|
+
]).toString()
|
|
1000
|
+
}).createNode({
|
|
1001
|
+
id: "gpt-APPEND",
|
|
1002
|
+
type: "append"
|
|
1003
|
+
}).createNode({
|
|
1004
|
+
id: "gpt-OUTPUT",
|
|
1005
|
+
type: NODE_OUTPUT
|
|
1006
|
+
}).createEdge({
|
|
1007
|
+
node: "gpt-INPUT",
|
|
1008
|
+
property: "prompt"
|
|
1009
|
+
}, {
|
|
1010
|
+
node: "gpt-GPT",
|
|
1011
|
+
property: "prompt"
|
|
1012
|
+
}).createEdge({
|
|
1013
|
+
node: "gpt-GPT",
|
|
1014
|
+
property: "text"
|
|
1015
|
+
}, {
|
|
1016
|
+
node: "gpt-OUTPUT",
|
|
1017
|
+
property: "text"
|
|
1018
|
+
}).createEdge({
|
|
1019
|
+
node: "gpt-QUEUE_ID",
|
|
1020
|
+
property: DEFAULT_OUTPUT
|
|
1021
|
+
}, {
|
|
1022
|
+
node: "gpt-APPEND",
|
|
1023
|
+
property: "id"
|
|
1024
|
+
}).createEdge({
|
|
1025
|
+
node: "gpt-GPT",
|
|
1026
|
+
property: "messages"
|
|
1027
|
+
}, {
|
|
1028
|
+
node: "gpt-APPEND",
|
|
1029
|
+
property: "items"
|
|
1030
|
+
}).createEdge({
|
|
1031
|
+
node: "gpt-QUEUE_ID",
|
|
1032
|
+
property: DEFAULT_OUTPUT
|
|
1033
|
+
}, {
|
|
1034
|
+
node: "gpt-OUTPUT",
|
|
1035
|
+
property: "queue"
|
|
1036
|
+
});
|
|
1037
|
+
return space.db.add(model.root);
|
|
1038
|
+
});
|
|
1039
|
+
cb?.(objects);
|
|
1040
|
+
return objects;
|
|
1041
|
+
}
|
|
1042
|
+
]
|
|
1043
|
+
]);
|
|
1022
1044
|
|
|
1023
|
-
// src/
|
|
1045
|
+
// src/containers/SpaceGenerator/SpaceGenerator.tsx
|
|
1024
1046
|
var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
1025
1047
|
const { invokePromise } = useOperationInvoker();
|
|
1026
1048
|
const client = useClient();
|
|
@@ -1037,7 +1059,7 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
1037
1059
|
];
|
|
1038
1060
|
const [count, setCount] = useState(1);
|
|
1039
1061
|
const [info, setInfo] = useState({});
|
|
1040
|
-
const presets = useMemo(() =>
|
|
1062
|
+
const presets = useMemo(() => generator(), []);
|
|
1041
1063
|
useAsyncEffect(async () => {
|
|
1042
1064
|
await client.addTypes([
|
|
1043
1065
|
...staticTypes,
|
|
@@ -1095,29 +1117,29 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
1095
1117
|
typeMap,
|
|
1096
1118
|
count
|
|
1097
1119
|
]);
|
|
1098
|
-
return /* @__PURE__ */ React2.createElement(
|
|
1099
|
-
|
|
1120
|
+
return /* @__PURE__ */ React2.createElement(Panel.Root, null, /* @__PURE__ */ React2.createElement(Panel.Toolbar, {
|
|
1121
|
+
asChild: true
|
|
1100
1122
|
}, /* @__PURE__ */ React2.createElement(Toolbar.Root, null, /* @__PURE__ */ React2.createElement(IconButton2, {
|
|
1101
1123
|
icon: "ph--arrow-clockwise--regular",
|
|
1102
1124
|
iconOnly: true,
|
|
1103
1125
|
label: "Refresh",
|
|
1104
1126
|
onClick: updateInfo
|
|
1105
|
-
}), /* @__PURE__ */ React2.createElement(Toolbar.Separator, {
|
|
1106
|
-
variant: "gap"
|
|
1107
|
-
}), /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.TextInput, {
|
|
1127
|
+
}), /* @__PURE__ */ React2.createElement(Toolbar.Separator, null), /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.TextInput, {
|
|
1108
1128
|
type: "number",
|
|
1109
1129
|
placeholder: "Count",
|
|
1110
|
-
classNames: "
|
|
1130
|
+
classNames: "w-[4rem] text-right",
|
|
1111
1131
|
min: 1,
|
|
1112
1132
|
max: 100,
|
|
1113
1133
|
size: 8,
|
|
1114
1134
|
value: count,
|
|
1115
1135
|
onChange: (event) => setCount(parseInt(event.target.value))
|
|
1116
|
-
}))), /* @__PURE__ */ React2.createElement(
|
|
1136
|
+
})))), /* @__PURE__ */ React2.createElement(Panel.Content, {
|
|
1137
|
+
asChild: true
|
|
1138
|
+
}, /* @__PURE__ */ React2.createElement(ScrollArea.Root, {
|
|
1117
1139
|
thin: true,
|
|
1118
1140
|
orientation: "vertical"
|
|
1119
1141
|
}, /* @__PURE__ */ React2.createElement(ScrollArea.Viewport, {
|
|
1120
|
-
classNames: "gap-4 divide-y divide-
|
|
1142
|
+
classNames: "gap-4 divide-y divide-subdued-separator"
|
|
1121
1143
|
}, /* @__PURE__ */ React2.createElement(SchemaTable, {
|
|
1122
1144
|
types: staticTypes,
|
|
1123
1145
|
objects: info.objects,
|
|
@@ -1141,12 +1163,12 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
1141
1163
|
...info
|
|
1142
1164
|
}, jsonKeyReplacer({
|
|
1143
1165
|
truncate: true
|
|
1144
|
-
}), 2)))));
|
|
1166
|
+
}), 2))))));
|
|
1145
1167
|
};
|
|
1146
1168
|
|
|
1147
|
-
// src/
|
|
1169
|
+
// src/containers/SpaceGenerator/index.ts
|
|
1148
1170
|
var SpaceGenerator_default = SpaceGenerator;
|
|
1149
1171
|
export {
|
|
1150
1172
|
SpaceGenerator_default as default
|
|
1151
1173
|
};
|
|
1152
|
-
//# sourceMappingURL=SpaceGenerator-
|
|
1174
|
+
//# sourceMappingURL=SpaceGenerator-SWSGJEEL.mjs.map
|