@dxos/plugin-debug 0.8.4-main.406dc2a → 0.8.4-main.52d7546f51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs +15 -0
- package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs.map +7 -0
- package/dist/lib/browser/DevtoolsOverviewContainer-2C6XMJ3L.mjs +19 -0
- package/dist/lib/browser/DevtoolsOverviewContainer-2C6XMJ3L.mjs.map +7 -0
- package/dist/lib/browser/{SpaceGenerator-VMWHGAJZ.mjs → SpaceGenerator-W3LJORYT.mjs} +259 -266
- package/dist/lib/browser/SpaceGenerator-W3LJORYT.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-DEBTVBQG.mjs +599 -0
- package/dist/lib/browser/app-graph-builder-DEBTVBQG.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SRV2AIGJ.mjs → chunk-4UFQXPP7.mjs} +11 -1
- package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +7 -0
- package/dist/lib/browser/chunk-A5H5GRV6.mjs +20 -0
- package/dist/lib/browser/chunk-A5H5GRV6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +36 -41
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-I3USIAF6.mjs +17 -0
- package/dist/lib/browser/react-context-I3USIAF6.mjs.map +7 -0
- package/dist/lib/browser/react-surface-FMVC5GPV.mjs +758 -0
- package/dist/lib/browser/react-surface-FMVC5GPV.mjs.map +7 -0
- package/dist/lib/browser/settings-SLTQJJNF.mjs +32 -0
- package/dist/lib/browser/settings-SLTQJJNF.mjs.map +7 -0
- package/dist/types/src/DebugPlugin.d.ts +2 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -8
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context/index.d.ts +7 -0
- package/dist/types/src/capabilities/react-context/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-context/react-context.d.ts +10 -0
- package/dist/types/src/capabilities/react-context/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +3 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +6 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/components/DebugGraph.d.ts +5 -4
- package/dist/types/src/components/DebugGraph.d.ts.map +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts +4 -2
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +5 -5
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +2 -5
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts +2 -2
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -1
- package/dist/types/src/types.d.ts +5 -0
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +77 -70
- package/src/DebugPlugin.tsx +17 -31
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +421 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/index.ts +4 -6
- package/src/capabilities/react-context/index.ts +7 -0
- package/src/capabilities/react-context/react-context.tsx +20 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +411 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +31 -0
- package/src/components/DebugGraph.tsx +4 -3
- package/src/components/DebugObjectPanel.tsx +4 -5
- package/src/components/DebugSettings.tsx +59 -33
- package/src/components/DevtoolsOverviewContainer.tsx +2 -2
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +25 -32
- package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +8 -6
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +35 -31
- package/src/components/SpaceGenerator/presets.ts +235 -120
- package/src/components/Wireframe.tsx +4 -5
- package/src/components/index.ts +4 -1
- package/src/meta.ts +7 -4
- package/src/translations.ts +1 -1
- package/src/types.ts +8 -0
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +0 -20
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +0 -7
- package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs +0 -25
- package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-VMWHGAJZ.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-I4IHBKKN.mjs +0 -588
- package/dist/lib/browser/app-graph-builder-I4IHBKKN.mjs.map +0 -7
- package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-SVCKCXCL.mjs +0 -16
- package/dist/lib/browser/chunk-SVCKCXCL.mjs.map +0 -7
- package/dist/lib/browser/react-context-QLZE7VSQ.mjs +0 -16
- package/dist/lib/browser/react-context-QLZE7VSQ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-GFORPA3A.mjs +0 -772
- package/dist/lib/browser/react-surface-GFORPA3A.mjs.map +0 -7
- package/dist/lib/browser/settings-EBVICEEW.mjs +0 -22
- package/dist/lib/browser/settings-EBVICEEW.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-context.d.ts +0 -8
- package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -431
- package/src/capabilities/react-context.tsx +0 -16
- package/src/capabilities/react-surface.tsx +0 -399
- package/src/capabilities/settings.ts +0 -19
|
@@ -1,55 +1,53 @@
|
|
|
1
1
|
// src/components/SpaceGenerator/SpaceGenerator.tsx
|
|
2
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
3
2
|
import React2, { useCallback, useMemo, useState } from "react";
|
|
4
|
-
import {
|
|
3
|
+
import { useOperationInvoker } from "@dxos/app-framework/ui";
|
|
5
4
|
import { ComputeGraph as ComputeGraph2 } from "@dxos/conductor";
|
|
6
|
-
import { Filter as Filter3 } from "@dxos/echo";
|
|
5
|
+
import { Filter as Filter3, Obj as Obj2 } from "@dxos/echo";
|
|
7
6
|
import { Markdown as Markdown3 } from "@dxos/plugin-markdown/types";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { Sheet as Sheet2 } from "@dxos/plugin-sheet/types";
|
|
8
|
+
import { Diagram as Diagram2 } from "@dxos/plugin-sketch/types";
|
|
10
9
|
import { useClient } from "@dxos/react-client";
|
|
11
|
-
import {
|
|
12
|
-
import { IconButton as IconButton2, Input, Toolbar, useAsyncEffect } from "@dxos/react-ui";
|
|
10
|
+
import { IconButton as IconButton2, Input, Layout, ScrollArea, Toolbar, useAsyncEffect } from "@dxos/react-ui";
|
|
13
11
|
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
14
|
-
import {
|
|
12
|
+
import { Organization as Organization2, Person as Person2, Task } from "@dxos/types";
|
|
15
13
|
import { jsonKeyReplacer, sortKeys } from "@dxos/util";
|
|
16
14
|
|
|
17
15
|
// src/components/SpaceGenerator/ObjectGenerator.tsx
|
|
18
|
-
import { createIntent } from "@dxos/app-framework";
|
|
19
16
|
import { addressToA1Notation } from "@dxos/compute";
|
|
20
17
|
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from "@dxos/conductor";
|
|
21
|
-
import { DXN, Filter, Key
|
|
18
|
+
import { DXN, Filter, Key } from "@dxos/echo";
|
|
22
19
|
import { Markdown } from "@dxos/plugin-markdown/types";
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import { SpaceAction } from "@dxos/plugin-space/types";
|
|
20
|
+
import { Sheet } from "@dxos/plugin-sheet/types";
|
|
21
|
+
import { Diagram } from "@dxos/plugin-sketch/types";
|
|
22
|
+
import { SpaceOperation } from "@dxos/plugin-space/types";
|
|
27
23
|
import { faker } from "@dxos/random";
|
|
28
|
-
import {
|
|
24
|
+
import { View, getTypenameFromQuery } from "@dxos/schema";
|
|
29
25
|
import { createAsyncGenerator } from "@dxos/schema/testing";
|
|
30
26
|
import { range } from "@dxos/util";
|
|
31
27
|
var generator = faker;
|
|
32
28
|
var findViewByTypename = async (views, typename) => {
|
|
33
29
|
return views.find((view) => getTypenameFromQuery(view.query.ast) === typename);
|
|
34
30
|
};
|
|
35
|
-
var createGenerator = (client,
|
|
31
|
+
var createGenerator = (client, invokePromise, schema) => {
|
|
36
32
|
return async (space, n) => {
|
|
37
33
|
const typename = schema.typename;
|
|
38
|
-
const
|
|
34
|
+
const views = await space.db.query(Filter.type(View.View)).run();
|
|
39
35
|
const view = await findViewByTypename(views, typename);
|
|
40
|
-
const staticSchema = client?.graph.schemaRegistry.
|
|
36
|
+
const staticSchema = client?.graph.schemaRegistry.query({
|
|
37
|
+
typename
|
|
38
|
+
}).runSync()[0];
|
|
41
39
|
if (!view && !staticSchema) {
|
|
42
|
-
await
|
|
43
|
-
space,
|
|
40
|
+
await invokePromise(SpaceOperation.AddSchema, {
|
|
41
|
+
db: space.db,
|
|
44
42
|
schema,
|
|
45
43
|
show: false
|
|
46
|
-
})
|
|
44
|
+
});
|
|
47
45
|
} else if (!view && staticSchema) {
|
|
48
|
-
await
|
|
49
|
-
space,
|
|
46
|
+
await invokePromise(SpaceOperation.UseStaticSchema, {
|
|
47
|
+
db: space.db,
|
|
50
48
|
typename,
|
|
51
49
|
show: false
|
|
52
|
-
})
|
|
50
|
+
});
|
|
53
51
|
}
|
|
54
52
|
const generate = createAsyncGenerator(generator, schema, {
|
|
55
53
|
db: space.db
|
|
@@ -62,7 +60,7 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
62
60
|
Markdown.Document.typename,
|
|
63
61
|
async (space, n, cb) => {
|
|
64
62
|
const objects = range(n).map(() => {
|
|
65
|
-
return space.db.add(Markdown.
|
|
63
|
+
return space.db.add(Markdown.make({
|
|
66
64
|
name: faker.commerce.productName(),
|
|
67
65
|
content: faker.lorem.sentences(5)
|
|
68
66
|
}));
|
|
@@ -72,14 +70,11 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
72
70
|
}
|
|
73
71
|
],
|
|
74
72
|
[
|
|
75
|
-
|
|
73
|
+
Diagram.Diagram.typename,
|
|
76
74
|
async (space, n, cb) => {
|
|
77
75
|
const objects = range(n).map(() => {
|
|
78
|
-
const obj = space.db.add(
|
|
79
|
-
name: faker.commerce.productName()
|
|
80
|
-
canvas: Ref.make(Obj.make(CanvasType, {
|
|
81
|
-
content: {}
|
|
82
|
-
}))
|
|
76
|
+
const obj = space.db.add(Diagram.make({
|
|
77
|
+
name: faker.commerce.productName()
|
|
83
78
|
}));
|
|
84
79
|
return obj;
|
|
85
80
|
});
|
|
@@ -89,7 +84,7 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
89
84
|
],
|
|
90
85
|
// TODO(burdon): Create unit tests.
|
|
91
86
|
[
|
|
92
|
-
|
|
87
|
+
Sheet.Sheet.typename,
|
|
93
88
|
async (space, n, cb) => {
|
|
94
89
|
const objects = range(n).map(() => {
|
|
95
90
|
const cells = {};
|
|
@@ -125,7 +120,7 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
125
120
|
}
|
|
126
121
|
}
|
|
127
122
|
}
|
|
128
|
-
return space.db.add(
|
|
123
|
+
return space.db.add(Sheet.make({
|
|
129
124
|
name: faker.commerce.productName(),
|
|
130
125
|
cells
|
|
131
126
|
}));
|
|
@@ -200,19 +195,20 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
200
195
|
|
|
201
196
|
// src/components/SpaceGenerator/presets.ts
|
|
202
197
|
import * as Schema from "effect/Schema";
|
|
203
|
-
import {
|
|
198
|
+
import { Agent, EntityExtraction, ResearchBlueprint } from "@dxos/assistant-toolkit";
|
|
204
199
|
import { Prompt } from "@dxos/blueprints";
|
|
205
200
|
import { NODE_INPUT as NODE_INPUT2 } from "@dxos/conductor";
|
|
206
|
-
import { DXN as DXN2, Filter as Filter2, Key as Key2, Obj
|
|
207
|
-
import {
|
|
201
|
+
import { DXN as DXN2, Filter as Filter2, Key as Key2, Obj, Query, Ref, Tag, Type } from "@dxos/echo";
|
|
202
|
+
import { Trigger, serializeFunction } from "@dxos/functions";
|
|
208
203
|
import { invariant } from "@dxos/invariant";
|
|
209
|
-
import {
|
|
204
|
+
import { gmail } from "@dxos/plugin-inbox";
|
|
210
205
|
import { Mailbox } from "@dxos/plugin-inbox/types";
|
|
211
206
|
import { Markdown as Markdown2 } from "@dxos/plugin-markdown/types";
|
|
212
207
|
import { createAppend, createChat, createComputeGraph, createConstant, createFunction, createGpt, createQueue, createRandom, createSurface, createTemplate, createText, createTrigger } from "@dxos/react-ui-canvas-compute";
|
|
213
|
-
import {
|
|
214
|
-
import {
|
|
215
|
-
import {
|
|
208
|
+
import { CanvasBoard, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from "@dxos/react-ui-canvas-editor";
|
|
209
|
+
import { View as View2 } from "@dxos/schema";
|
|
210
|
+
import { Message, Organization, Person, Pipeline } from "@dxos/types";
|
|
211
|
+
import { range as range2, trim } from "@dxos/util";
|
|
216
212
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-debug/src/components/SpaceGenerator/presets.ts";
|
|
217
213
|
var PresetName = /* @__PURE__ */ (function(PresetName2) {
|
|
218
214
|
PresetName2["DXOS_TEAM"] = "dxos-team";
|
|
@@ -220,15 +216,15 @@ var PresetName = /* @__PURE__ */ (function(PresetName2) {
|
|
|
220
216
|
PresetName2["GPT_QUEUE"] = "webhook-gpt-queue";
|
|
221
217
|
PresetName2["CHAT_GPT"] = "chat-gpt-text";
|
|
222
218
|
PresetName2["OBJECT_CHANGE_QUEUE"] = "objectChange-queue";
|
|
223
|
-
PresetName2["FOREX_FUNCTION_CALL"] = "forex-function-call";
|
|
224
219
|
PresetName2["TIMER_TICK_QUEUE"] = "timerTick-queue";
|
|
220
|
+
PresetName2["FOREX_FUNCTION_CALL"] = "forex-function-call";
|
|
225
221
|
PresetName2["DISCORD_MESSAGES"] = "discord-messages";
|
|
226
222
|
return PresetName2;
|
|
227
223
|
})({});
|
|
228
224
|
var generator2 = () => ({
|
|
229
225
|
schemas: [
|
|
230
|
-
|
|
231
|
-
|
|
226
|
+
CanvasBoard.CanvasBoard,
|
|
227
|
+
Trigger.Trigger
|
|
232
228
|
],
|
|
233
229
|
types: Object.values(PresetName).map((name) => ({
|
|
234
230
|
typename: name
|
|
@@ -238,44 +234,42 @@ var generator2 = () => ({
|
|
|
238
234
|
"dxos-team",
|
|
239
235
|
async (space, n, cb) => {
|
|
240
236
|
const objects = range2(n, () => {
|
|
241
|
-
const
|
|
242
|
-
label: "Investor"
|
|
243
|
-
}));
|
|
244
|
-
const tagDxn = Obj2.getDXN(tag).toString();
|
|
245
|
-
const org = space.db.add(Obj2.make(DataType2.Organization, {
|
|
237
|
+
const org = space.db.add(Obj.make(Organization.Organization, {
|
|
246
238
|
name: "DXOS",
|
|
247
239
|
website: "https://dxos.org"
|
|
248
240
|
}));
|
|
249
|
-
const doc = space.db.add(Markdown2.
|
|
241
|
+
const doc = space.db.add(Markdown2.make({
|
|
250
242
|
name: "DXOS Research",
|
|
251
243
|
content: "DXOS builds Composer, an open-source AI-powered malleable application."
|
|
252
244
|
}));
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
245
|
+
const tag = space.db.add(Tag.make({
|
|
246
|
+
label: "Investor"
|
|
247
|
+
}));
|
|
248
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
249
|
+
Obj.change(doc, (d) => {
|
|
250
|
+
Obj.getMeta(d).tags = [
|
|
251
|
+
tagDxn
|
|
252
|
+
];
|
|
253
|
+
});
|
|
254
|
+
space.db.add(Obj.make(Person.Person, {
|
|
257
255
|
fullName: "Rich",
|
|
258
|
-
organization:
|
|
256
|
+
organization: Ref.make(org)
|
|
259
257
|
}, {
|
|
260
258
|
tags: [
|
|
261
259
|
tagDxn
|
|
262
260
|
]
|
|
263
261
|
}));
|
|
264
|
-
space.db.add(
|
|
262
|
+
space.db.add(Obj.make(Person.Person, {
|
|
265
263
|
fullName: "Josiah",
|
|
266
|
-
organization:
|
|
264
|
+
organization: Ref.make(org)
|
|
267
265
|
}));
|
|
268
|
-
space.db.add(
|
|
266
|
+
space.db.add(Obj.make(Person.Person, {
|
|
269
267
|
fullName: "Dima",
|
|
270
|
-
organization:
|
|
268
|
+
organization: Ref.make(org)
|
|
271
269
|
}));
|
|
272
|
-
space.db.add(
|
|
270
|
+
space.db.add(Obj.make(Person.Person, {
|
|
273
271
|
fullName: "Mykola",
|
|
274
|
-
organization:
|
|
275
|
-
}));
|
|
276
|
-
space.db.add(Obj2.make(DataType2.Person, {
|
|
277
|
-
fullName: "Will",
|
|
278
|
-
organization: Ref2.make(org)
|
|
272
|
+
organization: Ref.make(org)
|
|
279
273
|
}));
|
|
280
274
|
return doc;
|
|
281
275
|
});
|
|
@@ -290,36 +284,34 @@ var generator2 = () => ({
|
|
|
290
284
|
const tag = await space.db.query(Filter2.type(Tag.Tag, {
|
|
291
285
|
label: "Investor"
|
|
292
286
|
})).first();
|
|
293
|
-
const tagDxn =
|
|
287
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
294
288
|
const objects = range2(n, () => {
|
|
295
|
-
const contactsQuery = Query.select(Filter2.type(
|
|
296
|
-
const organizationsQuery = Query.select(Filter2.type(
|
|
289
|
+
const contactsQuery = Query.select(Filter2.type(Person.Person)).select(Filter2.tag(tagDxn));
|
|
290
|
+
const organizationsQuery = Query.select(Filter2.type(Organization.Organization)).select(Filter2.tag(tagDxn));
|
|
297
291
|
const notesQuery = Query.select(Filter2.type(Markdown2.Document)).select(Filter2.tag(tagDxn));
|
|
298
|
-
|
|
292
|
+
space.db.add(Trigger.make({
|
|
299
293
|
enabled: true,
|
|
300
294
|
spec: {
|
|
301
295
|
kind: "timer",
|
|
302
296
|
cron: "* * * * *"
|
|
303
297
|
},
|
|
304
|
-
function:
|
|
298
|
+
function: Ref.make(serializeFunction(gmail.sync)),
|
|
305
299
|
input: {
|
|
306
|
-
|
|
300
|
+
mailbox: Ref.make(mailbox)
|
|
307
301
|
}
|
|
308
|
-
});
|
|
309
|
-
space.db.add(
|
|
310
|
-
const contactExtractionTrigger = Obj2.make(FunctionTrigger, {
|
|
302
|
+
}));
|
|
303
|
+
space.db.add(Trigger.make({
|
|
311
304
|
enabled: true,
|
|
312
305
|
// TODO(wittjosiah): Queue trigger doesn't support matching query of the column.
|
|
313
306
|
spec: {
|
|
314
307
|
kind: "queue",
|
|
315
308
|
queue: mailbox.queue.dxn.toString()
|
|
316
309
|
},
|
|
317
|
-
function:
|
|
310
|
+
function: Ref.make(serializeFunction(EntityExtraction.extract)),
|
|
318
311
|
input: {
|
|
319
312
|
source: "{{event.item}}"
|
|
320
313
|
}
|
|
321
|
-
});
|
|
322
|
-
space.db.add(contactExtractionTrigger);
|
|
314
|
+
}));
|
|
323
315
|
const researchPrompt = space.db.add(Prompt.make({
|
|
324
316
|
name: "Research",
|
|
325
317
|
description: "Research organization",
|
|
@@ -329,12 +321,16 @@ var generator2 = () => ({
|
|
|
329
321
|
output: Schema.Any,
|
|
330
322
|
// TODO(dmaretskyi): This mocks research (returns pre-baked result), the actual research might take compute minutes.
|
|
331
323
|
// Remove the mock prompt to do the actual research.
|
|
332
|
-
instructions:
|
|
324
|
+
instructions: trim`
|
|
325
|
+
Research the organization provided as input.
|
|
326
|
+
Create a research note for it at the end.
|
|
327
|
+
NOTE: Do mocked reseach (set mockSearch to true).
|
|
328
|
+
`,
|
|
333
329
|
blueprints: [
|
|
334
|
-
|
|
330
|
+
Ref.make(ResearchBlueprint)
|
|
335
331
|
]
|
|
336
332
|
}));
|
|
337
|
-
|
|
333
|
+
space.db.add(Trigger.make({
|
|
338
334
|
enabled: true,
|
|
339
335
|
spec: {
|
|
340
336
|
kind: "subscription",
|
|
@@ -342,16 +338,14 @@ var generator2 = () => ({
|
|
|
342
338
|
ast: organizationsQuery.ast
|
|
343
339
|
}
|
|
344
340
|
},
|
|
345
|
-
function:
|
|
341
|
+
function: Ref.make(serializeFunction(Agent.prompt)),
|
|
346
342
|
input: {
|
|
347
|
-
prompt:
|
|
343
|
+
prompt: Ref.make(researchPrompt),
|
|
348
344
|
input: "{{event.subject}}"
|
|
349
345
|
}
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
name: "Mailbox",
|
|
354
|
-
query: Query.select(Filter2.type(DataType2.Message, {
|
|
346
|
+
}));
|
|
347
|
+
const mailboxView = View2.make({
|
|
348
|
+
query: Query.select(Filter2.type(Message.Message, {
|
|
355
349
|
properties: {
|
|
356
350
|
labels: Filter2.contains("investor")
|
|
357
351
|
}
|
|
@@ -360,43 +354,44 @@ var generator2 = () => ({
|
|
|
360
354
|
mailbox.queue.dxn.toString()
|
|
361
355
|
]
|
|
362
356
|
}),
|
|
363
|
-
jsonSchema:
|
|
364
|
-
presentation: Obj2.make(DataType2.Collection, {
|
|
365
|
-
objects: []
|
|
366
|
-
})
|
|
357
|
+
jsonSchema: Type.toJsonSchema(Message.Message)
|
|
367
358
|
});
|
|
368
|
-
const contactsView =
|
|
369
|
-
name: "Contacts",
|
|
359
|
+
const contactsView = View2.make({
|
|
370
360
|
query: contactsQuery,
|
|
371
|
-
jsonSchema:
|
|
372
|
-
presentation: Obj2.make(DataType2.Collection, {
|
|
373
|
-
objects: []
|
|
374
|
-
})
|
|
361
|
+
jsonSchema: Type.toJsonSchema(Person.Person)
|
|
375
362
|
});
|
|
376
|
-
const organizationsView =
|
|
377
|
-
name: "Organizations",
|
|
363
|
+
const organizationsView = View2.make({
|
|
378
364
|
query: organizationsQuery,
|
|
379
|
-
jsonSchema:
|
|
380
|
-
presentation: Obj2.make(DataType2.Collection, {
|
|
381
|
-
objects: []
|
|
382
|
-
})
|
|
365
|
+
jsonSchema: Type.toJsonSchema(Organization.Organization)
|
|
383
366
|
});
|
|
384
|
-
const notesView =
|
|
385
|
-
name: "Notes",
|
|
367
|
+
const notesView = View2.make({
|
|
386
368
|
query: notesQuery,
|
|
387
|
-
jsonSchema:
|
|
388
|
-
presentation: Obj2.make(DataType2.Collection, {
|
|
389
|
-
objects: []
|
|
390
|
-
})
|
|
369
|
+
jsonSchema: Type.toJsonSchema(Markdown2.Document)
|
|
391
370
|
});
|
|
392
|
-
return space.db.add(
|
|
371
|
+
return space.db.add(Pipeline.make({
|
|
393
372
|
name: "Investor Research",
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
373
|
+
columns: [
|
|
374
|
+
{
|
|
375
|
+
name: "Mailbox",
|
|
376
|
+
view: Ref.make(mailboxView),
|
|
377
|
+
order: []
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
name: "Contacts",
|
|
381
|
+
view: Ref.make(contactsView),
|
|
382
|
+
order: []
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
name: "Organizations",
|
|
386
|
+
view: Ref.make(organizationsView),
|
|
387
|
+
order: []
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
name: "Notes",
|
|
391
|
+
view: Ref.make(notesView),
|
|
392
|
+
order: []
|
|
393
|
+
}
|
|
394
|
+
]
|
|
400
395
|
}));
|
|
401
396
|
});
|
|
402
397
|
cb?.(objects.flat());
|
|
@@ -867,20 +862,22 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
867
862
|
const triggerSpec = functionTrigger.spec;
|
|
868
863
|
invariant(triggerSpec && triggerSpec.kind === triggerKind, "No trigger spec.", {
|
|
869
864
|
F: __dxlog_file,
|
|
870
|
-
L:
|
|
865
|
+
L: 756,
|
|
871
866
|
S: void 0,
|
|
872
867
|
A: [
|
|
873
868
|
"triggerSpec && triggerSpec.kind === triggerKind",
|
|
874
869
|
"'No trigger spec.'"
|
|
875
870
|
]
|
|
876
871
|
});
|
|
877
|
-
|
|
872
|
+
Obj.change(functionTrigger, (ft) => {
|
|
873
|
+
initSpec(ft.spec);
|
|
874
|
+
});
|
|
878
875
|
});
|
|
879
876
|
const computeModel = createComputeGraph(canvasModel);
|
|
880
877
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
881
878
|
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
882
879
|
F: __dxlog_file,
|
|
883
|
-
L:
|
|
880
|
+
L: 765,
|
|
884
881
|
S: void 0,
|
|
885
882
|
A: [
|
|
886
883
|
"templateComputeNode",
|
|
@@ -893,7 +890,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
893
890
|
' "id": "@{{changeId}}"',
|
|
894
891
|
"}"
|
|
895
892
|
].join("\n");
|
|
896
|
-
templateComputeNode.inputSchema =
|
|
893
|
+
templateComputeNode.inputSchema = Type.toJsonSchema(Schema.Struct({
|
|
897
894
|
type: Schema.String,
|
|
898
895
|
changeId: Schema.String
|
|
899
896
|
}));
|
|
@@ -904,9 +901,9 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
904
901
|
};
|
|
905
902
|
};
|
|
906
903
|
var addToSpace = (name, space, canvas, compute) => {
|
|
907
|
-
return space.db.add(
|
|
904
|
+
return space.db.add(Obj.make(CanvasBoard.CanvasBoard, {
|
|
908
905
|
name,
|
|
909
|
-
computeGraph:
|
|
906
|
+
computeGraph: Ref.make(compute.root),
|
|
910
907
|
layout: canvas.graph
|
|
911
908
|
}));
|
|
912
909
|
};
|
|
@@ -942,16 +939,18 @@ var setupQueue = (space, canvasModel, args) => {
|
|
|
942
939
|
var attachTrigger = (functionTrigger, computeModel) => {
|
|
943
940
|
invariant(functionTrigger, void 0, {
|
|
944
941
|
F: __dxlog_file,
|
|
945
|
-
L:
|
|
942
|
+
L: 805,
|
|
946
943
|
S: void 0,
|
|
947
944
|
A: [
|
|
948
945
|
"functionTrigger",
|
|
949
946
|
""
|
|
950
947
|
]
|
|
951
948
|
});
|
|
952
|
-
functionTrigger.function = Ref2.make(computeModel.root);
|
|
953
949
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT2);
|
|
954
|
-
functionTrigger
|
|
950
|
+
Obj.change(functionTrigger, (t) => {
|
|
951
|
+
t.function = Ref.make(computeModel.root);
|
|
952
|
+
t.inputNodeId = inputNode.id;
|
|
953
|
+
});
|
|
955
954
|
};
|
|
956
955
|
var rawPosition = (args) => {
|
|
957
956
|
return {
|
|
@@ -998,157 +997,151 @@ var position = (rect) => {
|
|
|
998
997
|
};
|
|
999
998
|
|
|
1000
999
|
// src/components/SpaceGenerator/SchemaTable.tsx
|
|
1001
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
1002
1000
|
import React from "react";
|
|
1003
1001
|
import { IconButton } from "@dxos/react-ui";
|
|
1004
1002
|
var SchemaTable = ({ types, objects = {}, label, onClick }) => {
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
onClick: () => onClick(type.typename)
|
|
1024
|
-
}))));
|
|
1025
|
-
} finally {
|
|
1026
|
-
_effect.f();
|
|
1027
|
-
}
|
|
1003
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1004
|
+
className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
|
|
1005
|
+
}, /* @__PURE__ */ React.createElement("h2", {
|
|
1006
|
+
className: "p-2"
|
|
1007
|
+
}, label), types.map((type) => /* @__PURE__ */ React.createElement("div", {
|
|
1008
|
+
key: type.typename,
|
|
1009
|
+
className: "grid grid-cols-subgrid col-span-3 items-center"
|
|
1010
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1011
|
+
className: "pli-2 text-sm font-mono text-subdued"
|
|
1012
|
+
}, type.typename), /* @__PURE__ */ React.createElement("div", {
|
|
1013
|
+
className: "pli-2 text-right font-mono"
|
|
1014
|
+
}, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
|
|
1015
|
+
variant: "ghost",
|
|
1016
|
+
icon: "ph--plus--regular",
|
|
1017
|
+
iconOnly: true,
|
|
1018
|
+
label: "Create data",
|
|
1019
|
+
onClick: () => onClick(type.typename)
|
|
1020
|
+
}))));
|
|
1028
1021
|
};
|
|
1029
1022
|
|
|
1030
1023
|
// src/components/SpaceGenerator/SpaceGenerator.tsx
|
|
1031
1024
|
var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
...recordTypes,
|
|
1054
|
-
...presets.schemas
|
|
1055
|
-
]);
|
|
1056
|
-
const recordGenerators = new Map(recordTypes.map((type) => [
|
|
1057
|
-
type.typename,
|
|
1058
|
-
createGenerator(client, dispatch, type)
|
|
1059
|
-
]));
|
|
1060
|
-
return new Map([
|
|
1061
|
-
...staticGenerators,
|
|
1062
|
-
...presets.items,
|
|
1063
|
-
...recordGenerators
|
|
1064
|
-
]);
|
|
1065
|
-
}, [
|
|
1066
|
-
client,
|
|
1067
|
-
recordTypes
|
|
1025
|
+
const { invokePromise } = useOperationInvoker();
|
|
1026
|
+
const client = useClient();
|
|
1027
|
+
const staticTypes = [
|
|
1028
|
+
Markdown3.Document,
|
|
1029
|
+
Diagram2.Diagram,
|
|
1030
|
+
Sheet2.Sheet,
|
|
1031
|
+
ComputeGraph2
|
|
1032
|
+
];
|
|
1033
|
+
const recordTypes = [
|
|
1034
|
+
Organization2.Organization,
|
|
1035
|
+
Person2.Person,
|
|
1036
|
+
Task.Task
|
|
1037
|
+
];
|
|
1038
|
+
const [count, setCount] = useState(1);
|
|
1039
|
+
const [info, setInfo] = useState({});
|
|
1040
|
+
const presets = useMemo(() => generator2(), []);
|
|
1041
|
+
useAsyncEffect(async () => {
|
|
1042
|
+
await client.addTypes([
|
|
1043
|
+
...staticTypes,
|
|
1044
|
+
...recordTypes,
|
|
1045
|
+
...presets.schemas
|
|
1068
1046
|
]);
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
setInfo({
|
|
1082
|
-
schema: {
|
|
1083
|
-
static: staticSchema.length,
|
|
1084
|
-
mutable: echoSchema.length
|
|
1085
|
-
},
|
|
1086
|
-
objects: objectMap
|
|
1087
|
-
});
|
|
1088
|
-
};
|
|
1089
|
-
useAsyncEffect(updateInfo, [
|
|
1090
|
-
space
|
|
1047
|
+
}, [
|
|
1048
|
+
client
|
|
1049
|
+
]);
|
|
1050
|
+
const typeMap = useMemo(() => {
|
|
1051
|
+
const recordGenerators = new Map(recordTypes.map((type) => [
|
|
1052
|
+
type.typename,
|
|
1053
|
+
createGenerator(client, invokePromise, type)
|
|
1054
|
+
]));
|
|
1055
|
+
return new Map([
|
|
1056
|
+
...staticGenerators,
|
|
1057
|
+
...presets.items,
|
|
1058
|
+
...recordGenerators
|
|
1091
1059
|
]);
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1060
|
+
}, [
|
|
1061
|
+
client,
|
|
1062
|
+
recordTypes,
|
|
1063
|
+
invokePromise
|
|
1064
|
+
]);
|
|
1065
|
+
const updateInfo = async () => {
|
|
1066
|
+
const echoSchema = await space.db.schemaRegistry.query().run();
|
|
1067
|
+
const staticSchema = await space.db.graph.schemaRegistry.query().run();
|
|
1068
|
+
const objects = await space.db.query(Filter3.everything()).run();
|
|
1069
|
+
const objectMap = sortKeys(objects.reduce((map, obj) => {
|
|
1070
|
+
const type = Obj2.getTypename(obj);
|
|
1071
|
+
if (type) {
|
|
1072
|
+
const count2 = map[type] ?? 0;
|
|
1073
|
+
map[type] = count2 + 1;
|
|
1097
1074
|
}
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1075
|
+
return map;
|
|
1076
|
+
}, {}));
|
|
1077
|
+
setInfo({
|
|
1078
|
+
schema: {
|
|
1079
|
+
static: staticSchema.length,
|
|
1080
|
+
mutable: echoSchema.length
|
|
1081
|
+
},
|
|
1082
|
+
objects: objectMap
|
|
1083
|
+
});
|
|
1084
|
+
};
|
|
1085
|
+
useAsyncEffect(updateInfo, [
|
|
1086
|
+
space
|
|
1087
|
+
]);
|
|
1088
|
+
const handleCreateData = useCallback(async (typename) => {
|
|
1089
|
+
const constructor = typeMap.get(typename);
|
|
1090
|
+
if (constructor) {
|
|
1091
|
+
await constructor(space, count, onCreateObjects);
|
|
1092
|
+
await updateInfo();
|
|
1093
|
+
}
|
|
1094
|
+
}, [
|
|
1095
|
+
typeMap,
|
|
1096
|
+
count
|
|
1097
|
+
]);
|
|
1098
|
+
return /* @__PURE__ */ React2.createElement(Layout.Main, {
|
|
1099
|
+
toolbar: true
|
|
1100
|
+
}, /* @__PURE__ */ React2.createElement(Toolbar.Root, null, /* @__PURE__ */ React2.createElement(IconButton2, {
|
|
1101
|
+
icon: "ph--arrow-clockwise--regular",
|
|
1102
|
+
iconOnly: true,
|
|
1103
|
+
label: "Refresh",
|
|
1104
|
+
onClick: updateInfo
|
|
1105
|
+
}), /* @__PURE__ */ React2.createElement(Toolbar.Separator, {
|
|
1106
|
+
variant: "gap"
|
|
1107
|
+
}), /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.TextInput, {
|
|
1108
|
+
type: "number",
|
|
1109
|
+
placeholder: "Count",
|
|
1110
|
+
classNames: "is-[4rem] text-right",
|
|
1111
|
+
min: 1,
|
|
1112
|
+
max: 100,
|
|
1113
|
+
size: 8,
|
|
1114
|
+
value: count,
|
|
1115
|
+
onChange: (event) => setCount(parseInt(event.target.value))
|
|
1116
|
+
}))), /* @__PURE__ */ React2.createElement(ScrollArea.Root, {
|
|
1117
|
+
thin: true,
|
|
1118
|
+
orientation: "vertical"
|
|
1119
|
+
}, /* @__PURE__ */ React2.createElement(ScrollArea.Viewport, {
|
|
1120
|
+
classNames: "gap-4 divide-y divide-subduedSeparator"
|
|
1121
|
+
}, /* @__PURE__ */ React2.createElement(SchemaTable, {
|
|
1122
|
+
types: staticTypes,
|
|
1123
|
+
objects: info.objects,
|
|
1124
|
+
label: "Static Types",
|
|
1125
|
+
onClick: handleCreateData
|
|
1126
|
+
}), /* @__PURE__ */ React2.createElement(SchemaTable, {
|
|
1127
|
+
types: recordTypes,
|
|
1128
|
+
objects: info.objects,
|
|
1129
|
+
label: "Record Types",
|
|
1130
|
+
onClick: handleCreateData
|
|
1131
|
+
}), /* @__PURE__ */ React2.createElement(SchemaTable, {
|
|
1132
|
+
types: presets.types,
|
|
1133
|
+
objects: info.objects,
|
|
1134
|
+
label: "Presets",
|
|
1135
|
+
onClick: handleCreateData
|
|
1136
|
+
}), /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
|
|
1137
|
+
language: "json",
|
|
1138
|
+
classNames: "text-xs"
|
|
1139
|
+
}, JSON.stringify({
|
|
1140
|
+
space,
|
|
1141
|
+
...info
|
|
1142
|
+
}, jsonKeyReplacer({
|
|
1143
|
+
truncate: true
|
|
1144
|
+
}), 2)))));
|
|
1152
1145
|
};
|
|
1153
1146
|
|
|
1154
1147
|
// src/components/SpaceGenerator/index.ts
|
|
@@ -1156,4 +1149,4 @@ var SpaceGenerator_default = SpaceGenerator;
|
|
|
1156
1149
|
export {
|
|
1157
1150
|
SpaceGenerator_default as default
|
|
1158
1151
|
};
|
|
1159
|
-
//# sourceMappingURL=SpaceGenerator-
|
|
1152
|
+
//# sourceMappingURL=SpaceGenerator-W3LJORYT.mjs.map
|