@dxos/plugin-debug 0.8.4-main.67995b8 → 0.8.4-main.ae835ea
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/{SpaceGenerator-6ZOCEREN.mjs → SpaceGenerator-7Q7CX64P.mjs} +262 -84
- package/dist/lib/browser/SpaceGenerator-7Q7CX64P.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-SQXFD2BL.mjs → app-graph-builder-RXWTHLEW.mjs} +75 -84
- package/dist/lib/browser/app-graph-builder-RXWTHLEW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-AJA6RYN3.mjs → chunk-SRV2AIGJ.mjs} +2 -2
- package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-WZFZ4ESO.mjs +20 -0
- package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +12 -12
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-context-NVAGLAJD.mjs → react-context-P2YDWEWI.mjs} +6 -6
- package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-CHHHE5CF.mjs → react-surface-4XGZUT3Z.mjs} +80 -76
- package/dist/lib/browser/react-surface-4XGZUT3Z.mjs.map +7 -0
- package/dist/lib/browser/{settings-LSSWLM5I.mjs → settings-SQXR3OAH.mjs} +5 -5
- package/dist/lib/browser/{settings-LSSWLM5I.mjs.map → settings-SQXR3OAH.mjs.map} +1 -1
- package/dist/types/src/DebugPlugin.d.ts +1 -1
- package/dist/types/src/DebugPlugin.d.ts.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/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +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 -4
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +5 -2
- 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/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +67 -65
- package/src/DebugPlugin.tsx +6 -7
- package/src/capabilities/app-graph-builder.ts +63 -89
- package/src/capabilities/react-context.tsx +2 -2
- package/src/capabilities/react-surface.tsx +49 -47
- package/src/components/DebugGraph.tsx +14 -0
- package/src/components/DebugObjectPanel.tsx +2 -4
- package/src/components/DebugSettings.tsx +75 -67
- package/src/components/DebugStatus.tsx +2 -2
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +18 -24
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +11 -11
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +8 -8
- package/src/components/SpaceGenerator/draw-util.ts +5 -5
- package/src/components/SpaceGenerator/presets.ts +185 -20
- package/src/components/Wireframe.tsx +2 -1
- package/src/components/index.ts +1 -1
- package/src/meta.ts +6 -5
- package/src/translations.ts +2 -0
- package/src/types.ts +1 -1
- package/dist/lib/browser/DebugApp-ZDL4CPY5.mjs +0 -228
- package/dist/lib/browser/DebugApp-ZDL4CPY5.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-6ZOCEREN.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-SQXFD2BL.mjs.map +0 -7
- package/dist/lib/browser/chunk-5XPIRNQS.mjs +0 -18
- package/dist/lib/browser/chunk-5XPIRNQS.mjs.map +0 -7
- package/dist/lib/browser/chunk-AJA6RYN3.mjs.map +0 -7
- package/dist/lib/browser/react-context-NVAGLAJD.mjs.map +0 -7
- package/dist/lib/browser/react-surface-CHHHE5CF.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 -84
- package/src/components/DebugApp/Tree.tsx +0 -103
- package/src/components/DebugApp/index.ts +0 -7
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/components/DebugGraph.tsx
|
|
2
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Tree } from "@dxos/devtools";
|
|
5
|
+
var DebugGraph = ({ graph, root }) => {
|
|
6
|
+
var _effect = _useSignals();
|
|
7
|
+
try {
|
|
8
|
+
return /* @__PURE__ */ React.createElement(Tree, {
|
|
9
|
+
data: graph.toJSON(root)
|
|
10
|
+
});
|
|
11
|
+
} finally {
|
|
12
|
+
_effect.f();
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var DebugGraph_default = DebugGraph;
|
|
16
|
+
export {
|
|
17
|
+
DebugGraph,
|
|
18
|
+
DebugGraph_default as default
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=DebugGraph-EDOH6R2G.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/DebugGraph.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nimport { Tree } from '@dxos/devtools';\nimport { type Graph } from '@dxos/plugin-graph';\n\nexport const DebugGraph: FC<{ graph: Graph; root: string }> = ({ graph, root }) => {\n return <Tree data={graph.toJSON(root)} />;\n};\n\nexport default DebugGraph;\n"],
|
|
5
|
+
"mappings": ";;AAIA,OAAOA,WAAwB;AAE/B,SAASC,YAAY;AAGd,IAAMC,aAAiD,CAAC,EAAEC,OAAOC,KAAI,MAAE;;;AAC5E,WAAO,sBAAA,cAACC,MAAAA;MAAKC,MAAMH,MAAMI,OAAOH,IAAAA;;;;;AAClC;AAEA,IAAA,qBAAeF;",
|
|
6
|
+
"names": ["React", "Tree", "DebugGraph", "graph", "root", "Tree", "data", "toJSON"]
|
|
7
|
+
}
|
|
@@ -3,37 +3,36 @@ import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking"
|
|
|
3
3
|
import React2, { useCallback, useMemo, useState } from "react";
|
|
4
4
|
import { useIntentDispatcher } from "@dxos/app-framework";
|
|
5
5
|
import { ComputeGraph as ComputeGraph2 } from "@dxos/conductor";
|
|
6
|
-
import { Filter as
|
|
7
|
-
import { Markdown as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { Filter as Filter3 } from "@dxos/echo";
|
|
7
|
+
import { Markdown as Markdown3 } from "@dxos/plugin-markdown/types";
|
|
8
|
+
import { Sheet as Sheet2 } from "@dxos/plugin-sheet/types";
|
|
9
|
+
import { Diagram as Diagram2 } from "@dxos/plugin-sketch/types";
|
|
10
10
|
import { useClient } from "@dxos/react-client";
|
|
11
11
|
import { getTypename } from "@dxos/react-client/echo";
|
|
12
12
|
import { IconButton as IconButton2, Input, Toolbar, useAsyncEffect } from "@dxos/react-ui";
|
|
13
13
|
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
14
|
-
import { DataType as
|
|
14
|
+
import { DataType as DataType3 } from "@dxos/schema";
|
|
15
15
|
import { jsonKeyReplacer, sortKeys } from "@dxos/util";
|
|
16
16
|
|
|
17
17
|
// src/components/SpaceGenerator/ObjectGenerator.tsx
|
|
18
18
|
import { createIntent } from "@dxos/app-framework";
|
|
19
19
|
import { addressToA1Notation } from "@dxos/compute";
|
|
20
20
|
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from "@dxos/conductor";
|
|
21
|
-
import { DXN, Filter, Key,
|
|
21
|
+
import { DXN, Filter, Key, Type } from "@dxos/echo";
|
|
22
22
|
import { Markdown } from "@dxos/plugin-markdown/types";
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import { CanvasType, DiagramType } from "@dxos/plugin-sketch/types";
|
|
23
|
+
import { Sheet } from "@dxos/plugin-sheet/types";
|
|
24
|
+
import { Diagram } from "@dxos/plugin-sketch/types";
|
|
26
25
|
import { SpaceAction } from "@dxos/plugin-space/types";
|
|
27
26
|
import { faker } from "@dxos/random";
|
|
28
|
-
import { DataType } from "@dxos/schema";
|
|
27
|
+
import { DataType, getTypenameFromQuery } from "@dxos/schema";
|
|
29
28
|
import { createAsyncGenerator } from "@dxos/schema/testing";
|
|
30
29
|
import { range } from "@dxos/util";
|
|
31
30
|
var generator = faker;
|
|
32
31
|
var findViewByTypename = async (views, typename) => {
|
|
33
|
-
return views.find((view) => view.query.
|
|
32
|
+
return views.find((view) => getTypenameFromQuery(view.query.ast) === typename);
|
|
34
33
|
};
|
|
35
34
|
var createGenerator = (client, dispatch, schema) => {
|
|
36
|
-
return async (space, n
|
|
35
|
+
return async (space, n) => {
|
|
37
36
|
const typename = schema.typename;
|
|
38
37
|
const { objects: views } = await space.db.query(Filter.type(DataType.View)).run();
|
|
39
38
|
const view = await findViewByTypename(views, typename);
|
|
@@ -41,12 +40,14 @@ var createGenerator = (client, dispatch, schema) => {
|
|
|
41
40
|
if (!view && !staticSchema) {
|
|
42
41
|
await dispatch(createIntent(SpaceAction.AddSchema, {
|
|
43
42
|
space,
|
|
44
|
-
schema
|
|
43
|
+
schema,
|
|
44
|
+
show: false
|
|
45
45
|
}));
|
|
46
46
|
} else if (!view && staticSchema) {
|
|
47
47
|
await dispatch(createIntent(SpaceAction.UseStaticSchema, {
|
|
48
48
|
space,
|
|
49
|
-
typename
|
|
49
|
+
typename,
|
|
50
|
+
show: false
|
|
50
51
|
}));
|
|
51
52
|
}
|
|
52
53
|
const generate = createAsyncGenerator(generator, schema, {
|
|
@@ -70,14 +71,11 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
70
71
|
}
|
|
71
72
|
],
|
|
72
73
|
[
|
|
73
|
-
|
|
74
|
+
Diagram.Diagram.typename,
|
|
74
75
|
async (space, n, cb) => {
|
|
75
76
|
const objects = range(n).map(() => {
|
|
76
|
-
const obj = space.db.add(
|
|
77
|
-
name: faker.commerce.productName()
|
|
78
|
-
canvas: Ref.make(Obj.make(CanvasType, {
|
|
79
|
-
content: {}
|
|
80
|
-
}))
|
|
77
|
+
const obj = space.db.add(Diagram.make({
|
|
78
|
+
name: faker.commerce.productName()
|
|
81
79
|
}));
|
|
82
80
|
return obj;
|
|
83
81
|
});
|
|
@@ -87,7 +85,7 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
87
85
|
],
|
|
88
86
|
// TODO(burdon): Create unit tests.
|
|
89
87
|
[
|
|
90
|
-
|
|
88
|
+
Sheet.Sheet.typename,
|
|
91
89
|
async (space, n, cb) => {
|
|
92
90
|
const objects = range(n).map(() => {
|
|
93
91
|
const cells = {};
|
|
@@ -123,7 +121,7 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
123
121
|
}
|
|
124
122
|
}
|
|
125
123
|
}
|
|
126
|
-
return space.db.add(
|
|
124
|
+
return space.db.add(Sheet.make({
|
|
127
125
|
name: faker.commerce.productName(),
|
|
128
126
|
cells
|
|
129
127
|
}));
|
|
@@ -196,47 +194,25 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
196
194
|
]
|
|
197
195
|
]);
|
|
198
196
|
|
|
199
|
-
// src/components/SpaceGenerator/SchemaTable.tsx
|
|
200
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
201
|
-
import React from "react";
|
|
202
|
-
import { IconButton } from "@dxos/react-ui";
|
|
203
|
-
var SchemaTable = ({ types, objects = {}, label, onClick }) => {
|
|
204
|
-
var _effect = _useSignals();
|
|
205
|
-
try {
|
|
206
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
207
|
-
className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
|
|
208
|
-
}, /* @__PURE__ */ React.createElement("h2", {
|
|
209
|
-
className: "p-2"
|
|
210
|
-
}, label), types.map((type) => /* @__PURE__ */ React.createElement("div", {
|
|
211
|
-
key: type.typename,
|
|
212
|
-
className: "grid grid-cols-subgrid col-span-3 items-center"
|
|
213
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
214
|
-
className: "px-2 text-sm font-mono text-subdued"
|
|
215
|
-
}, type.typename), /* @__PURE__ */ React.createElement("div", {
|
|
216
|
-
className: "px-2 text-right font-mono"
|
|
217
|
-
}, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
|
|
218
|
-
variant: "ghost",
|
|
219
|
-
icon: "ph--plus--regular",
|
|
220
|
-
iconOnly: true,
|
|
221
|
-
label: "Create data",
|
|
222
|
-
onClick: () => onClick(type.typename)
|
|
223
|
-
}))));
|
|
224
|
-
} finally {
|
|
225
|
-
_effect.f();
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
|
|
229
197
|
// src/components/SpaceGenerator/presets.ts
|
|
230
|
-
import
|
|
198
|
+
import * as Schema from "effect/Schema";
|
|
199
|
+
import { Agent, EntityExtraction, ResearchBlueprint } from "@dxos/assistant-toolkit";
|
|
200
|
+
import { Prompt } from "@dxos/blueprints";
|
|
231
201
|
import { NODE_INPUT as NODE_INPUT2 } from "@dxos/conductor";
|
|
232
|
-
import { DXN as DXN2, Key as Key2, Obj
|
|
233
|
-
import {
|
|
202
|
+
import { DXN as DXN2, Filter as Filter2, Key as Key2, Obj, Query, Ref, Tag, Type as Type2 } from "@dxos/echo";
|
|
203
|
+
import { Trigger, serializeFunction } from "@dxos/functions";
|
|
234
204
|
import { invariant } from "@dxos/invariant";
|
|
235
|
-
import {
|
|
205
|
+
import { sync } from "@dxos/plugin-inbox";
|
|
206
|
+
import { Mailbox } from "@dxos/plugin-inbox/types";
|
|
207
|
+
import { Markdown as Markdown2 } from "@dxos/plugin-markdown/types";
|
|
208
|
+
import { createAppend, createChat, createComputeGraph, createConstant, createFunction, createGpt, createQueue, createRandom, createSurface, createTemplate, createText, createTrigger } from "@dxos/react-ui-canvas-compute";
|
|
236
209
|
import { CanvasBoardType, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from "@dxos/react-ui-canvas-editor";
|
|
237
|
-
import {
|
|
210
|
+
import { DataType as DataType2, createView } from "@dxos/schema";
|
|
211
|
+
import { range as range2, trim } from "@dxos/util";
|
|
238
212
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-debug/src/components/SpaceGenerator/presets.ts";
|
|
239
|
-
var PresetName = /* @__PURE__ */ function(PresetName2) {
|
|
213
|
+
var PresetName = /* @__PURE__ */ (function(PresetName2) {
|
|
214
|
+
PresetName2["DXOS_TEAM"] = "dxos-team";
|
|
215
|
+
PresetName2["ORG_RESEARCH_PROJECT"] = "org-research-project";
|
|
240
216
|
PresetName2["GPT_QUEUE"] = "webhook-gpt-queue";
|
|
241
217
|
PresetName2["CHAT_GPT"] = "chat-gpt-text";
|
|
242
218
|
PresetName2["OBJECT_CHANGE_QUEUE"] = "objectChange-queue";
|
|
@@ -244,16 +220,189 @@ var PresetName = /* @__PURE__ */ function(PresetName2) {
|
|
|
244
220
|
PresetName2["TIMER_TICK_QUEUE"] = "timerTick-queue";
|
|
245
221
|
PresetName2["DISCORD_MESSAGES"] = "discord-messages";
|
|
246
222
|
return PresetName2;
|
|
247
|
-
}({});
|
|
223
|
+
})({});
|
|
248
224
|
var generator2 = () => ({
|
|
249
225
|
schemas: [
|
|
250
226
|
CanvasBoardType,
|
|
251
|
-
|
|
227
|
+
Trigger.Trigger
|
|
252
228
|
],
|
|
253
229
|
types: Object.values(PresetName).map((name) => ({
|
|
254
230
|
typename: name
|
|
255
231
|
})),
|
|
256
232
|
items: [
|
|
233
|
+
[
|
|
234
|
+
"dxos-team",
|
|
235
|
+
async (space, n, cb) => {
|
|
236
|
+
const objects = range2(n, () => {
|
|
237
|
+
const tag = space.db.add(Tag.make({
|
|
238
|
+
label: "Investor"
|
|
239
|
+
}));
|
|
240
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
241
|
+
const org = space.db.add(Obj.make(DataType2.Organization, {
|
|
242
|
+
name: "DXOS",
|
|
243
|
+
website: "https://dxos.org"
|
|
244
|
+
}));
|
|
245
|
+
const doc = space.db.add(Markdown2.makeDocument({
|
|
246
|
+
name: "DXOS Research",
|
|
247
|
+
content: "DXOS builds Composer, an open-source AI-powered malleable application."
|
|
248
|
+
}));
|
|
249
|
+
Obj.getMeta(doc).tags = [
|
|
250
|
+
tagDxn
|
|
251
|
+
];
|
|
252
|
+
space.db.add(Obj.make(DataType2.Person, {
|
|
253
|
+
fullName: "Rich",
|
|
254
|
+
organization: Ref.make(org)
|
|
255
|
+
}, {
|
|
256
|
+
tags: [
|
|
257
|
+
tagDxn
|
|
258
|
+
]
|
|
259
|
+
}));
|
|
260
|
+
space.db.add(Obj.make(DataType2.Person, {
|
|
261
|
+
fullName: "Josiah",
|
|
262
|
+
organization: Ref.make(org)
|
|
263
|
+
}));
|
|
264
|
+
space.db.add(Obj.make(DataType2.Person, {
|
|
265
|
+
fullName: "Dima",
|
|
266
|
+
organization: Ref.make(org)
|
|
267
|
+
}));
|
|
268
|
+
space.db.add(Obj.make(DataType2.Person, {
|
|
269
|
+
fullName: "Mykola",
|
|
270
|
+
organization: Ref.make(org)
|
|
271
|
+
}));
|
|
272
|
+
space.db.add(Obj.make(DataType2.Person, {
|
|
273
|
+
fullName: "Will",
|
|
274
|
+
organization: Ref.make(org)
|
|
275
|
+
}));
|
|
276
|
+
return doc;
|
|
277
|
+
});
|
|
278
|
+
cb?.(objects);
|
|
279
|
+
return objects;
|
|
280
|
+
}
|
|
281
|
+
],
|
|
282
|
+
[
|
|
283
|
+
"org-research-project",
|
|
284
|
+
async (space, n, cb) => {
|
|
285
|
+
const mailbox = await space.db.query(Filter2.type(Mailbox.Mailbox)).first();
|
|
286
|
+
const tag = await space.db.query(Filter2.type(Tag.Tag, {
|
|
287
|
+
label: "Investor"
|
|
288
|
+
})).first();
|
|
289
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
290
|
+
const objects = range2(n, () => {
|
|
291
|
+
const contactsQuery = Query.select(Filter2.type(DataType2.Person)).select(Filter2.tag(tagDxn));
|
|
292
|
+
const organizationsQuery = Query.select(Filter2.type(DataType2.Organization)).select(Filter2.tag(tagDxn));
|
|
293
|
+
const notesQuery = Query.select(Filter2.type(Markdown2.Document)).select(Filter2.tag(tagDxn));
|
|
294
|
+
const emailSyncTrigger = Trigger.make({
|
|
295
|
+
enabled: true,
|
|
296
|
+
spec: {
|
|
297
|
+
kind: "timer",
|
|
298
|
+
cron: "* * * * *"
|
|
299
|
+
},
|
|
300
|
+
function: Ref.make(serializeFunction(sync)),
|
|
301
|
+
input: {
|
|
302
|
+
mailboxId: Obj.getDXN(mailbox).toString()
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
space.db.add(emailSyncTrigger);
|
|
306
|
+
const contactExtractionTrigger = Trigger.make({
|
|
307
|
+
enabled: true,
|
|
308
|
+
// TODO(wittjosiah): Queue trigger doesn't support matching query of the column.
|
|
309
|
+
spec: {
|
|
310
|
+
kind: "queue",
|
|
311
|
+
queue: mailbox.queue.dxn.toString()
|
|
312
|
+
},
|
|
313
|
+
function: Ref.make(serializeFunction(EntityExtraction.extract)),
|
|
314
|
+
input: {
|
|
315
|
+
source: "{{event.item}}"
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
space.db.add(contactExtractionTrigger);
|
|
319
|
+
const researchPrompt = space.db.add(Prompt.make({
|
|
320
|
+
name: "Research",
|
|
321
|
+
description: "Research organization",
|
|
322
|
+
input: Schema.Struct({
|
|
323
|
+
org: Schema.Any
|
|
324
|
+
}),
|
|
325
|
+
output: Schema.Any,
|
|
326
|
+
// TODO(dmaretskyi): This mocks research (returns pre-baked result), the actual research might take compute minutes.
|
|
327
|
+
// Remove the mock prompt to do the actual research.
|
|
328
|
+
instructions: trim`
|
|
329
|
+
Research the organization provided as input.
|
|
330
|
+
Create a research note for it at the end.
|
|
331
|
+
NOTE: Do mocked reseach (set mockSearch to true).
|
|
332
|
+
`,
|
|
333
|
+
blueprints: [
|
|
334
|
+
Ref.make(ResearchBlueprint)
|
|
335
|
+
]
|
|
336
|
+
}));
|
|
337
|
+
const researchTrigger = Trigger.make({
|
|
338
|
+
enabled: true,
|
|
339
|
+
spec: {
|
|
340
|
+
kind: "subscription",
|
|
341
|
+
query: {
|
|
342
|
+
ast: organizationsQuery.ast
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
function: Ref.make(serializeFunction(Agent.prompt)),
|
|
346
|
+
input: {
|
|
347
|
+
prompt: Ref.make(researchPrompt),
|
|
348
|
+
input: "{{event.subject}}"
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
space.db.add(researchTrigger);
|
|
352
|
+
const mailboxView = createView({
|
|
353
|
+
name: "Mailbox",
|
|
354
|
+
query: Query.select(Filter2.type(DataType2.Message, {
|
|
355
|
+
properties: {
|
|
356
|
+
labels: Filter2.contains("investor")
|
|
357
|
+
}
|
|
358
|
+
})).options({
|
|
359
|
+
queues: [
|
|
360
|
+
mailbox.queue.dxn.toString()
|
|
361
|
+
]
|
|
362
|
+
}),
|
|
363
|
+
jsonSchema: Type2.toJsonSchema(DataType2.Message),
|
|
364
|
+
presentation: Obj.make(DataType2.Collection, {
|
|
365
|
+
objects: []
|
|
366
|
+
})
|
|
367
|
+
});
|
|
368
|
+
const contactsView = createView({
|
|
369
|
+
name: "Contacts",
|
|
370
|
+
query: contactsQuery,
|
|
371
|
+
jsonSchema: Type2.toJsonSchema(DataType2.Person),
|
|
372
|
+
presentation: Obj.make(DataType2.Collection, {
|
|
373
|
+
objects: []
|
|
374
|
+
})
|
|
375
|
+
});
|
|
376
|
+
const organizationsView = createView({
|
|
377
|
+
name: "Organizations",
|
|
378
|
+
query: organizationsQuery,
|
|
379
|
+
jsonSchema: Type2.toJsonSchema(DataType2.Organization),
|
|
380
|
+
presentation: Obj.make(DataType2.Collection, {
|
|
381
|
+
objects: []
|
|
382
|
+
})
|
|
383
|
+
});
|
|
384
|
+
const notesView = createView({
|
|
385
|
+
name: "Notes",
|
|
386
|
+
query: notesQuery,
|
|
387
|
+
jsonSchema: Type2.toJsonSchema(Markdown2.Document),
|
|
388
|
+
presentation: Obj.make(DataType2.Collection, {
|
|
389
|
+
objects: []
|
|
390
|
+
})
|
|
391
|
+
});
|
|
392
|
+
return space.db.add(DataType2.makeProject({
|
|
393
|
+
name: "Investor Research",
|
|
394
|
+
collections: [
|
|
395
|
+
mailboxView,
|
|
396
|
+
contactsView,
|
|
397
|
+
organizationsView,
|
|
398
|
+
notesView
|
|
399
|
+
].map((view) => Ref.make(view))
|
|
400
|
+
}));
|
|
401
|
+
});
|
|
402
|
+
cb?.(objects.flat());
|
|
403
|
+
return objects.flat();
|
|
404
|
+
}
|
|
405
|
+
],
|
|
257
406
|
[
|
|
258
407
|
"webhook-gpt-queue",
|
|
259
408
|
async (space, n, cb) => {
|
|
@@ -267,7 +416,7 @@ var generator2 = () => ({
|
|
|
267
416
|
})));
|
|
268
417
|
const triggerShape = createTrigger({
|
|
269
418
|
spaceId: space.id,
|
|
270
|
-
triggerKind:
|
|
419
|
+
triggerKind: "webhook",
|
|
271
420
|
...position({
|
|
272
421
|
x: -18,
|
|
273
422
|
y: -2
|
|
@@ -318,8 +467,8 @@ var generator2 = () => ({
|
|
|
318
467
|
"objectChange-queue",
|
|
319
468
|
async (space, n, cb) => {
|
|
320
469
|
const objects = range2(n, () => {
|
|
321
|
-
const { canvasModel, computeModel } = createQueueSinkPreset(space,
|
|
322
|
-
|
|
470
|
+
const { canvasModel, computeModel } = createQueueSinkPreset(space, "subscription", (triggerSpec) => triggerSpec.query = {
|
|
471
|
+
ast: Query.select(Filter2.typename("dxos.org/type/Chess")).ast
|
|
323
472
|
}, "type");
|
|
324
473
|
return addToSpace("objectChange-queue", space, canvasModel, computeModel);
|
|
325
474
|
});
|
|
@@ -331,7 +480,7 @@ var generator2 = () => ({
|
|
|
331
480
|
"timerTick-queue",
|
|
332
481
|
async (space, n, cb) => {
|
|
333
482
|
const objects = range2(n, () => {
|
|
334
|
-
const { canvasModel, computeModel } = createQueueSinkPreset(space,
|
|
483
|
+
const { canvasModel, computeModel } = createQueueSinkPreset(space, "timer", (triggerSpec) => triggerSpec.cron = "*/5 * * * * *", "result");
|
|
335
484
|
return addToSpace("timerTick-queue", space, canvasModel, computeModel);
|
|
336
485
|
});
|
|
337
486
|
cb?.(objects);
|
|
@@ -358,7 +507,7 @@ var generator2 = () => ({
|
|
|
358
507
|
// canvasModel.builder.call((builder) => {
|
|
359
508
|
// const triggerShape = createTrigger({
|
|
360
509
|
// spaceId: space.id,
|
|
361
|
-
// triggerKind:
|
|
510
|
+
// triggerKind: 'email',
|
|
362
511
|
// ...position({ x: -18, y: -2 }),
|
|
363
512
|
// });
|
|
364
513
|
// const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -473,7 +622,7 @@ var generator2 = () => ({
|
|
|
473
622
|
// );
|
|
474
623
|
// const triggerShape = createTrigger({
|
|
475
624
|
// spaceId: space.id,
|
|
476
|
-
// triggerKind:
|
|
625
|
+
// triggerKind: 'email',
|
|
477
626
|
// ...rawPosition({ centerX: -736, centerY: -384, width: 182, height: 192 }),
|
|
478
627
|
// });
|
|
479
628
|
// const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -582,7 +731,7 @@ var generator2 = () => ({
|
|
|
582
731
|
canvasModel.builder.call((builder) => {
|
|
583
732
|
const triggerShape = createTrigger({
|
|
584
733
|
spaceId: space.id,
|
|
585
|
-
triggerKind:
|
|
734
|
+
triggerKind: "timer",
|
|
586
735
|
...position({
|
|
587
736
|
x: -10,
|
|
588
737
|
y: -5
|
|
@@ -718,7 +867,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
718
867
|
const triggerSpec = functionTrigger.spec;
|
|
719
868
|
invariant(triggerSpec && triggerSpec.kind === triggerKind, "No trigger spec.", {
|
|
720
869
|
F: __dxlog_file,
|
|
721
|
-
L:
|
|
870
|
+
L: 661,
|
|
722
871
|
S: void 0,
|
|
723
872
|
A: [
|
|
724
873
|
"triggerSpec && triggerSpec.kind === triggerKind",
|
|
@@ -731,7 +880,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
731
880
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
732
881
|
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
733
882
|
F: __dxlog_file,
|
|
734
|
-
L:
|
|
883
|
+
L: 668,
|
|
735
884
|
S: void 0,
|
|
736
885
|
A: [
|
|
737
886
|
"templateComputeNode",
|
|
@@ -755,9 +904,9 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
755
904
|
};
|
|
756
905
|
};
|
|
757
906
|
var addToSpace = (name, space, canvas, compute) => {
|
|
758
|
-
return space.db.add(
|
|
907
|
+
return space.db.add(Obj.make(CanvasBoardType, {
|
|
759
908
|
name,
|
|
760
|
-
computeGraph:
|
|
909
|
+
computeGraph: Ref.make(compute.root),
|
|
761
910
|
layout: canvas.graph
|
|
762
911
|
}));
|
|
763
912
|
};
|
|
@@ -793,14 +942,14 @@ var setupQueue = (space, canvasModel, args) => {
|
|
|
793
942
|
var attachTrigger = (functionTrigger, computeModel) => {
|
|
794
943
|
invariant(functionTrigger, void 0, {
|
|
795
944
|
F: __dxlog_file,
|
|
796
|
-
L:
|
|
945
|
+
L: 707,
|
|
797
946
|
S: void 0,
|
|
798
947
|
A: [
|
|
799
948
|
"functionTrigger",
|
|
800
949
|
""
|
|
801
950
|
]
|
|
802
951
|
});
|
|
803
|
-
functionTrigger.function =
|
|
952
|
+
functionTrigger.function = Ref.make(computeModel.root);
|
|
804
953
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT2);
|
|
805
954
|
functionTrigger.inputNodeId = inputNode.id;
|
|
806
955
|
};
|
|
@@ -848,6 +997,36 @@ var position = (rect) => {
|
|
|
848
997
|
}
|
|
849
998
|
};
|
|
850
999
|
|
|
1000
|
+
// src/components/SpaceGenerator/SchemaTable.tsx
|
|
1001
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
1002
|
+
import React from "react";
|
|
1003
|
+
import { IconButton } from "@dxos/react-ui";
|
|
1004
|
+
var SchemaTable = ({ types, objects = {}, label, onClick }) => {
|
|
1005
|
+
var _effect = _useSignals();
|
|
1006
|
+
try {
|
|
1007
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1008
|
+
className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
|
|
1009
|
+
}, /* @__PURE__ */ React.createElement("h2", {
|
|
1010
|
+
className: "p-2"
|
|
1011
|
+
}, label), types.map((type) => /* @__PURE__ */ React.createElement("div", {
|
|
1012
|
+
key: type.typename,
|
|
1013
|
+
className: "grid grid-cols-subgrid col-span-3 items-center"
|
|
1014
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1015
|
+
className: "px-2 text-sm font-mono text-subdued"
|
|
1016
|
+
}, type.typename), /* @__PURE__ */ React.createElement("div", {
|
|
1017
|
+
className: "px-2 text-right font-mono"
|
|
1018
|
+
}, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
|
|
1019
|
+
variant: "ghost",
|
|
1020
|
+
icon: "ph--plus--regular",
|
|
1021
|
+
iconOnly: true,
|
|
1022
|
+
label: "Create data",
|
|
1023
|
+
onClick: () => onClick(type.typename)
|
|
1024
|
+
}))));
|
|
1025
|
+
} finally {
|
|
1026
|
+
_effect.f();
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
|
|
851
1030
|
// src/components/SpaceGenerator/SpaceGenerator.tsx
|
|
852
1031
|
var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
853
1032
|
var _effect = _useSignals2();
|
|
@@ -855,16 +1034,15 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
855
1034
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
856
1035
|
const client = useClient();
|
|
857
1036
|
const staticTypes = [
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
1037
|
+
Markdown3.Document,
|
|
1038
|
+
Diagram2.Diagram,
|
|
1039
|
+
Sheet2.Sheet,
|
|
861
1040
|
ComputeGraph2
|
|
862
1041
|
];
|
|
863
1042
|
const recordTypes = [
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
DataType2.Message
|
|
1043
|
+
DataType3.Organization,
|
|
1044
|
+
DataType3.Person,
|
|
1045
|
+
DataType3.Task
|
|
868
1046
|
];
|
|
869
1047
|
const [count, setCount] = useState(1);
|
|
870
1048
|
const [info, setInfo] = useState({});
|
|
@@ -891,7 +1069,7 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
891
1069
|
const updateInfo = async () => {
|
|
892
1070
|
const echoSchema = await space.db.schemaRegistry.query().run();
|
|
893
1071
|
const staticSchema = space.db.graph.schemaRegistry.schemas;
|
|
894
|
-
const { objects } = await space.db.query(
|
|
1072
|
+
const { objects } = await space.db.query(Filter3.everything()).run();
|
|
895
1073
|
const objectMap = sortKeys(objects.reduce((map, obj) => {
|
|
896
1074
|
const type = getTypename(obj);
|
|
897
1075
|
if (type) {
|
|
@@ -960,8 +1138,8 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
960
1138
|
label: "Presets",
|
|
961
1139
|
onClick: handleCreateData
|
|
962
1140
|
}), /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
|
|
963
|
-
|
|
964
|
-
|
|
1141
|
+
language: "json",
|
|
1142
|
+
classNames: "text-xs"
|
|
965
1143
|
}, JSON.stringify({
|
|
966
1144
|
space,
|
|
967
1145
|
...info
|
|
@@ -978,4 +1156,4 @@ var SpaceGenerator_default = SpaceGenerator;
|
|
|
978
1156
|
export {
|
|
979
1157
|
SpaceGenerator_default as default
|
|
980
1158
|
};
|
|
981
|
-
//# sourceMappingURL=SpaceGenerator-
|
|
1159
|
+
//# sourceMappingURL=SpaceGenerator-7Q7CX64P.mjs.map
|