@dxos/plugin-debug 0.8.4-main.5acf9ea → 0.8.4-main.66e292d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +20 -0
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +7 -0
- package/dist/lib/browser/{DevtoolsOverviewContainer-EPD6EWT5.mjs → DevtoolsOverviewContainer-JXVZVPHN.mjs} +2 -2
- package/dist/lib/browser/{DevtoolsOverviewContainer-EPD6EWT5.mjs.map → DevtoolsOverviewContainer-JXVZVPHN.mjs.map} +1 -1
- package/dist/lib/browser/{SpaceGenerator-6ZOCEREN.mjs → SpaceGenerator-BED4UXGS.mjs} +261 -90
- package/dist/lib/browser/SpaceGenerator-BED4UXGS.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-SQXFD2BL.mjs → app-graph-builder-CRH2HJKT.mjs} +77 -86
- package/dist/lib/browser/app-graph-builder-CRH2HJKT.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 +13 -13
- 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-JM2H3RZI.mjs} +104 -98
- package/dist/lib/browser/react-surface-JM2H3RZI.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 +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 +51 -4
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts +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 +3 -1
- 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 +69 -66
- package/src/DebugPlugin.tsx +6 -7
- package/src/capabilities/app-graph-builder.ts +68 -94
- package/src/capabilities/react-context.tsx +2 -2
- package/src/capabilities/react-surface.tsx +77 -56
- package/src/components/DebugGraph.tsx +14 -0
- package/src/components/DebugObjectPanel.tsx +2 -4
- package/src/components/DebugSettings.tsx +102 -73
- package/src/components/DebugStatus.tsx +2 -2
- package/src/components/DevtoolsOverviewContainer.tsx +1 -1
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +21 -27
- package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +11 -11
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +12 -12
- package/src/components/SpaceGenerator/draw-util.ts +5 -5
- package/src/components/SpaceGenerator/presets.ts +200 -21
- package/src/components/Wireframe.tsx +4 -4
- package/src/components/index.ts +1 -1
- package/src/meta.ts +6 -5
- package/src/translations.ts +3 -1
- 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
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/components/DevtoolsOverviewContainer.tsx
|
|
2
2
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { Surface } from "@dxos/app-framework";
|
|
4
|
+
import { Surface } from "@dxos/app-framework/react";
|
|
5
5
|
import { StatsPanel, useStats } from "@dxos/devtools";
|
|
6
6
|
var DevtoolsOverviewContainer = () => {
|
|
7
7
|
var _effect = _useSignals();
|
|
@@ -22,4 +22,4 @@ export {
|
|
|
22
22
|
DevtoolsOverviewContainer,
|
|
23
23
|
DevtoolsOverviewContainer_default as default
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=DevtoolsOverviewContainer-
|
|
25
|
+
//# sourceMappingURL=DevtoolsOverviewContainer-JXVZVPHN.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/DevtoolsOverviewContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Surface } from '@dxos/app-framework';\nimport { StatsPanel, useStats } from '@dxos/devtools';\n\nexport const DevtoolsOverviewContainer = () => {\n const [stats, refreshStats] = useStats();\n\n return (\n <StatsPanel stats={stats} onRefresh={refreshStats}>\n <Surface role='devtools-overview' />\n </StatsPanel>\n );\n};\n\nexport default DevtoolsOverviewContainer;\n"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Surface } from '@dxos/app-framework/react';\nimport { StatsPanel, useStats } from '@dxos/devtools';\n\nexport const DevtoolsOverviewContainer = () => {\n const [stats, refreshStats] = useStats();\n\n return (\n <StatsPanel stats={stats} onRefresh={refreshStats}>\n <Surface role='devtools-overview' />\n </StatsPanel>\n );\n};\n\nexport default DevtoolsOverviewContainer;\n"],
|
|
5
5
|
"mappings": ";;AAIA,OAAOA,WAAW;AAElB,SAASC,eAAe;AACxB,SAASC,YAAYC,gBAAgB;AAE9B,IAAMC,4BAA4B,MAAA;;;AACvC,UAAM,CAACC,OAAOC,YAAAA,IAAgBC,SAAAA;AAE9B,WACE,sBAAA,cAACC,YAAAA;MAAWH;MAAcI,WAAWH;OACnC,sBAAA,cAACI,SAAAA;MAAQC,MAAK;;;;;AAGpB;AAEA,IAAA,oCAAeP;",
|
|
6
6
|
"names": ["React", "Surface", "StatsPanel", "useStats", "DevtoolsOverviewContainer", "stats", "refreshStats", "useStats", "StatsPanel", "onRefresh", "Surface", "role"]
|
|
7
7
|
}
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
// src/components/SpaceGenerator/SpaceGenerator.tsx
|
|
2
2
|
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
3
3
|
import React2, { useCallback, useMemo, useState } from "react";
|
|
4
|
-
import { useIntentDispatcher } from "@dxos/app-framework";
|
|
4
|
+
import { useIntentDispatcher } from "@dxos/app-framework/react";
|
|
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, Obj as Obj2 } 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
|
-
import { getTypename } from "@dxos/react-client/echo";
|
|
12
11
|
import { IconButton as IconButton2, Input, Toolbar, useAsyncEffect } from "@dxos/react-ui";
|
|
13
12
|
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
14
|
-
import {
|
|
13
|
+
import { Organization as Organization2, Person as Person2, Task } from "@dxos/types";
|
|
15
14
|
import { jsonKeyReplacer, sortKeys } from "@dxos/util";
|
|
16
15
|
|
|
17
16
|
// src/components/SpaceGenerator/ObjectGenerator.tsx
|
|
18
17
|
import { createIntent } from "@dxos/app-framework";
|
|
19
18
|
import { addressToA1Notation } from "@dxos/compute";
|
|
20
19
|
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from "@dxos/conductor";
|
|
21
|
-
import { DXN, Filter, Key,
|
|
20
|
+
import { DXN, Filter, Key, Type } from "@dxos/echo";
|
|
22
21
|
import { Markdown } from "@dxos/plugin-markdown/types";
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import { CanvasType, DiagramType } from "@dxos/plugin-sketch/types";
|
|
22
|
+
import { Sheet } from "@dxos/plugin-sheet/types";
|
|
23
|
+
import { Diagram } from "@dxos/plugin-sketch/types";
|
|
26
24
|
import { SpaceAction } from "@dxos/plugin-space/types";
|
|
27
25
|
import { faker } from "@dxos/random";
|
|
28
|
-
import {
|
|
26
|
+
import { View, getTypenameFromQuery } from "@dxos/schema";
|
|
29
27
|
import { createAsyncGenerator } from "@dxos/schema/testing";
|
|
30
28
|
import { range } from "@dxos/util";
|
|
31
29
|
var generator = faker;
|
|
32
30
|
var findViewByTypename = async (views, typename) => {
|
|
33
|
-
return views.find((view) => view.query.
|
|
31
|
+
return views.find((view) => getTypenameFromQuery(view.query.ast) === typename);
|
|
34
32
|
};
|
|
35
33
|
var createGenerator = (client, dispatch, schema) => {
|
|
36
|
-
return async (space, n
|
|
34
|
+
return async (space, n) => {
|
|
37
35
|
const typename = schema.typename;
|
|
38
|
-
const { objects: views } = await space.db.query(Filter.type(
|
|
36
|
+
const { objects: views } = await space.db.query(Filter.type(View.View)).run();
|
|
39
37
|
const view = await findViewByTypename(views, typename);
|
|
40
38
|
const staticSchema = client?.graph.schemaRegistry.schemas.find((schema2) => Type.getTypename(schema2) === typename);
|
|
41
39
|
if (!view && !staticSchema) {
|
|
42
40
|
await dispatch(createIntent(SpaceAction.AddSchema, {
|
|
43
41
|
space,
|
|
44
|
-
schema
|
|
42
|
+
schema,
|
|
43
|
+
show: false
|
|
45
44
|
}));
|
|
46
45
|
} else if (!view && staticSchema) {
|
|
47
46
|
await dispatch(createIntent(SpaceAction.UseStaticSchema, {
|
|
48
47
|
space,
|
|
49
|
-
typename
|
|
48
|
+
typename,
|
|
49
|
+
show: false
|
|
50
50
|
}));
|
|
51
51
|
}
|
|
52
52
|
const generate = createAsyncGenerator(generator, schema, {
|
|
@@ -60,7 +60,7 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
60
60
|
Markdown.Document.typename,
|
|
61
61
|
async (space, n, cb) => {
|
|
62
62
|
const objects = range(n).map(() => {
|
|
63
|
-
return space.db.add(Markdown.
|
|
63
|
+
return space.db.add(Markdown.make({
|
|
64
64
|
name: faker.commerce.productName(),
|
|
65
65
|
content: faker.lorem.sentences(5)
|
|
66
66
|
}));
|
|
@@ -70,14 +70,11 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
70
70
|
}
|
|
71
71
|
],
|
|
72
72
|
[
|
|
73
|
-
|
|
73
|
+
Diagram.Diagram.typename,
|
|
74
74
|
async (space, n, cb) => {
|
|
75
75
|
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
|
-
}))
|
|
76
|
+
const obj = space.db.add(Diagram.make({
|
|
77
|
+
name: faker.commerce.productName()
|
|
81
78
|
}));
|
|
82
79
|
return obj;
|
|
83
80
|
});
|
|
@@ -87,7 +84,7 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
87
84
|
],
|
|
88
85
|
// TODO(burdon): Create unit tests.
|
|
89
86
|
[
|
|
90
|
-
|
|
87
|
+
Sheet.Sheet.typename,
|
|
91
88
|
async (space, n, cb) => {
|
|
92
89
|
const objects = range(n).map(() => {
|
|
93
90
|
const cells = {};
|
|
@@ -123,7 +120,7 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
123
120
|
}
|
|
124
121
|
}
|
|
125
122
|
}
|
|
126
|
-
return space.db.add(
|
|
123
|
+
return space.db.add(Sheet.make({
|
|
127
124
|
name: faker.commerce.productName(),
|
|
128
125
|
cells
|
|
129
126
|
}));
|
|
@@ -196,64 +193,209 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
196
193
|
]
|
|
197
194
|
]);
|
|
198
195
|
|
|
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
196
|
// src/components/SpaceGenerator/presets.ts
|
|
230
|
-
import
|
|
197
|
+
import * as Schema from "effect/Schema";
|
|
198
|
+
import { Agent, EntityExtraction, ResearchBlueprint } from "@dxos/assistant-toolkit";
|
|
199
|
+
import { Prompt } from "@dxos/blueprints";
|
|
231
200
|
import { NODE_INPUT as NODE_INPUT2 } from "@dxos/conductor";
|
|
232
|
-
import { DXN as DXN2, Key as Key2, Obj
|
|
233
|
-
import {
|
|
201
|
+
import { DXN as DXN2, Filter as Filter2, Key as Key2, Obj, Query, Ref, Tag, Type as Type2 } from "@dxos/echo";
|
|
202
|
+
import { Trigger, serializeFunction } from "@dxos/functions";
|
|
234
203
|
import { invariant } from "@dxos/invariant";
|
|
235
|
-
import {
|
|
204
|
+
import { gmail } from "@dxos/plugin-inbox";
|
|
205
|
+
import { Mailbox } from "@dxos/plugin-inbox/types";
|
|
206
|
+
import { Markdown as Markdown2 } from "@dxos/plugin-markdown/types";
|
|
207
|
+
import { createAppend, createChat, createComputeGraph, createConstant, createFunction, createGpt, createQueue, createRandom, createSurface, createTemplate, createText, createTrigger } from "@dxos/react-ui-canvas-compute";
|
|
236
208
|
import { CanvasBoardType, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from "@dxos/react-ui-canvas-editor";
|
|
237
|
-
import {
|
|
209
|
+
import { View as View2 } from "@dxos/schema";
|
|
210
|
+
import { Message, Organization, Person, Project } from "@dxos/types";
|
|
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";
|
|
243
|
-
PresetName2["FOREX_FUNCTION_CALL"] = "forex-function-call";
|
|
244
219
|
PresetName2["TIMER_TICK_QUEUE"] = "timerTick-queue";
|
|
220
|
+
PresetName2["FOREX_FUNCTION_CALL"] = "forex-function-call";
|
|
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 org = space.db.add(Obj.make(Organization.Organization, {
|
|
238
|
+
name: "DXOS",
|
|
239
|
+
website: "https://dxos.org"
|
|
240
|
+
}));
|
|
241
|
+
const doc = space.db.add(Markdown2.make({
|
|
242
|
+
name: "DXOS Research",
|
|
243
|
+
content: "DXOS builds Composer, an open-source AI-powered malleable application."
|
|
244
|
+
}));
|
|
245
|
+
const tag = space.db.add(Tag.make({
|
|
246
|
+
label: "Investor"
|
|
247
|
+
}));
|
|
248
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
249
|
+
Obj.getMeta(doc).tags = [
|
|
250
|
+
tagDxn
|
|
251
|
+
];
|
|
252
|
+
space.db.add(Obj.make(Person.Person, {
|
|
253
|
+
fullName: "Rich",
|
|
254
|
+
organization: Ref.make(org)
|
|
255
|
+
}, {
|
|
256
|
+
tags: [
|
|
257
|
+
tagDxn
|
|
258
|
+
]
|
|
259
|
+
}));
|
|
260
|
+
space.db.add(Obj.make(Person.Person, {
|
|
261
|
+
fullName: "Josiah",
|
|
262
|
+
organization: Ref.make(org)
|
|
263
|
+
}));
|
|
264
|
+
space.db.add(Obj.make(Person.Person, {
|
|
265
|
+
fullName: "Dima",
|
|
266
|
+
organization: Ref.make(org)
|
|
267
|
+
}));
|
|
268
|
+
space.db.add(Obj.make(Person.Person, {
|
|
269
|
+
fullName: "Mykola",
|
|
270
|
+
organization: Ref.make(org)
|
|
271
|
+
}));
|
|
272
|
+
return doc;
|
|
273
|
+
});
|
|
274
|
+
cb?.(objects);
|
|
275
|
+
return objects;
|
|
276
|
+
}
|
|
277
|
+
],
|
|
278
|
+
[
|
|
279
|
+
"org-research-project",
|
|
280
|
+
async (space, n, cb) => {
|
|
281
|
+
const mailbox = await space.db.query(Filter2.type(Mailbox.Mailbox)).first();
|
|
282
|
+
const tag = await space.db.query(Filter2.type(Tag.Tag, {
|
|
283
|
+
label: "Investor"
|
|
284
|
+
})).first();
|
|
285
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
286
|
+
const objects = range2(n, () => {
|
|
287
|
+
const contactsQuery = Query.select(Filter2.type(Person.Person)).select(Filter2.tag(tagDxn));
|
|
288
|
+
const organizationsQuery = Query.select(Filter2.type(Organization.Organization)).select(Filter2.tag(tagDxn));
|
|
289
|
+
const notesQuery = Query.select(Filter2.type(Markdown2.Document)).select(Filter2.tag(tagDxn));
|
|
290
|
+
space.db.add(Trigger.make({
|
|
291
|
+
enabled: true,
|
|
292
|
+
spec: {
|
|
293
|
+
kind: "timer",
|
|
294
|
+
cron: "* * * * *"
|
|
295
|
+
},
|
|
296
|
+
function: Ref.make(serializeFunction(gmail.sync)),
|
|
297
|
+
input: {
|
|
298
|
+
mailboxId: Obj.getDXN(mailbox).toString()
|
|
299
|
+
}
|
|
300
|
+
}));
|
|
301
|
+
space.db.add(Trigger.make({
|
|
302
|
+
enabled: true,
|
|
303
|
+
// TODO(wittjosiah): Queue trigger doesn't support matching query of the column.
|
|
304
|
+
spec: {
|
|
305
|
+
kind: "queue",
|
|
306
|
+
queue: mailbox.queue.dxn.toString()
|
|
307
|
+
},
|
|
308
|
+
function: Ref.make(serializeFunction(EntityExtraction.extract)),
|
|
309
|
+
input: {
|
|
310
|
+
source: "{{event.item}}"
|
|
311
|
+
}
|
|
312
|
+
}));
|
|
313
|
+
const researchPrompt = space.db.add(Prompt.make({
|
|
314
|
+
name: "Research",
|
|
315
|
+
description: "Research organization",
|
|
316
|
+
input: Schema.Struct({
|
|
317
|
+
org: Schema.Any
|
|
318
|
+
}),
|
|
319
|
+
output: Schema.Any,
|
|
320
|
+
// TODO(dmaretskyi): This mocks research (returns pre-baked result), the actual research might take compute minutes.
|
|
321
|
+
// Remove the mock prompt to do the actual research.
|
|
322
|
+
instructions: trim`
|
|
323
|
+
Research the organization provided as input.
|
|
324
|
+
Create a research note for it at the end.
|
|
325
|
+
NOTE: Do mocked reseach (set mockSearch to true).
|
|
326
|
+
`,
|
|
327
|
+
blueprints: [
|
|
328
|
+
Ref.make(ResearchBlueprint)
|
|
329
|
+
]
|
|
330
|
+
}));
|
|
331
|
+
space.db.add(Trigger.make({
|
|
332
|
+
enabled: true,
|
|
333
|
+
spec: {
|
|
334
|
+
kind: "subscription",
|
|
335
|
+
query: {
|
|
336
|
+
ast: organizationsQuery.ast
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
function: Ref.make(serializeFunction(Agent.prompt)),
|
|
340
|
+
input: {
|
|
341
|
+
prompt: Ref.make(researchPrompt),
|
|
342
|
+
input: "{{event.subject}}"
|
|
343
|
+
}
|
|
344
|
+
}));
|
|
345
|
+
const mailboxView = View2.make({
|
|
346
|
+
query: Query.select(Filter2.type(Message.Message, {
|
|
347
|
+
properties: {
|
|
348
|
+
labels: Filter2.contains("investor")
|
|
349
|
+
}
|
|
350
|
+
})).options({
|
|
351
|
+
queues: [
|
|
352
|
+
mailbox.queue.dxn.toString()
|
|
353
|
+
]
|
|
354
|
+
}),
|
|
355
|
+
jsonSchema: Type2.toJsonSchema(Message.Message)
|
|
356
|
+
});
|
|
357
|
+
const contactsView = View2.make({
|
|
358
|
+
query: contactsQuery,
|
|
359
|
+
jsonSchema: Type2.toJsonSchema(Person.Person)
|
|
360
|
+
});
|
|
361
|
+
const organizationsView = View2.make({
|
|
362
|
+
query: organizationsQuery,
|
|
363
|
+
jsonSchema: Type2.toJsonSchema(Organization.Organization)
|
|
364
|
+
});
|
|
365
|
+
const notesView = View2.make({
|
|
366
|
+
query: notesQuery,
|
|
367
|
+
jsonSchema: Type2.toJsonSchema(Markdown2.Document)
|
|
368
|
+
});
|
|
369
|
+
return space.db.add(Project.make({
|
|
370
|
+
name: "Investor Research",
|
|
371
|
+
columns: [
|
|
372
|
+
{
|
|
373
|
+
name: "Mailbox",
|
|
374
|
+
view: Ref.make(mailboxView),
|
|
375
|
+
order: []
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
name: "Contacts",
|
|
379
|
+
view: Ref.make(contactsView),
|
|
380
|
+
order: []
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
name: "Organizations",
|
|
384
|
+
view: Ref.make(organizationsView),
|
|
385
|
+
order: []
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
name: "Notes",
|
|
389
|
+
view: Ref.make(notesView),
|
|
390
|
+
order: []
|
|
391
|
+
}
|
|
392
|
+
]
|
|
393
|
+
}));
|
|
394
|
+
});
|
|
395
|
+
cb?.(objects.flat());
|
|
396
|
+
return objects.flat();
|
|
397
|
+
}
|
|
398
|
+
],
|
|
257
399
|
[
|
|
258
400
|
"webhook-gpt-queue",
|
|
259
401
|
async (space, n, cb) => {
|
|
@@ -267,7 +409,7 @@ var generator2 = () => ({
|
|
|
267
409
|
})));
|
|
268
410
|
const triggerShape = createTrigger({
|
|
269
411
|
spaceId: space.id,
|
|
270
|
-
triggerKind:
|
|
412
|
+
triggerKind: "webhook",
|
|
271
413
|
...position({
|
|
272
414
|
x: -18,
|
|
273
415
|
y: -2
|
|
@@ -318,8 +460,8 @@ var generator2 = () => ({
|
|
|
318
460
|
"objectChange-queue",
|
|
319
461
|
async (space, n, cb) => {
|
|
320
462
|
const objects = range2(n, () => {
|
|
321
|
-
const { canvasModel, computeModel } = createQueueSinkPreset(space,
|
|
322
|
-
|
|
463
|
+
const { canvasModel, computeModel } = createQueueSinkPreset(space, "subscription", (triggerSpec) => triggerSpec.query = {
|
|
464
|
+
ast: Query.select(Filter2.typename("dxos.org/type/Chess")).ast
|
|
323
465
|
}, "type");
|
|
324
466
|
return addToSpace("objectChange-queue", space, canvasModel, computeModel);
|
|
325
467
|
});
|
|
@@ -331,7 +473,7 @@ var generator2 = () => ({
|
|
|
331
473
|
"timerTick-queue",
|
|
332
474
|
async (space, n, cb) => {
|
|
333
475
|
const objects = range2(n, () => {
|
|
334
|
-
const { canvasModel, computeModel } = createQueueSinkPreset(space,
|
|
476
|
+
const { canvasModel, computeModel } = createQueueSinkPreset(space, "timer", (triggerSpec) => triggerSpec.cron = "*/5 * * * * *", "result");
|
|
335
477
|
return addToSpace("timerTick-queue", space, canvasModel, computeModel);
|
|
336
478
|
});
|
|
337
479
|
cb?.(objects);
|
|
@@ -358,7 +500,7 @@ var generator2 = () => ({
|
|
|
358
500
|
// canvasModel.builder.call((builder) => {
|
|
359
501
|
// const triggerShape = createTrigger({
|
|
360
502
|
// spaceId: space.id,
|
|
361
|
-
// triggerKind:
|
|
503
|
+
// triggerKind: 'email',
|
|
362
504
|
// ...position({ x: -18, y: -2 }),
|
|
363
505
|
// });
|
|
364
506
|
// const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -473,7 +615,7 @@ var generator2 = () => ({
|
|
|
473
615
|
// );
|
|
474
616
|
// const triggerShape = createTrigger({
|
|
475
617
|
// spaceId: space.id,
|
|
476
|
-
// triggerKind:
|
|
618
|
+
// triggerKind: 'email',
|
|
477
619
|
// ...rawPosition({ centerX: -736, centerY: -384, width: 182, height: 192 }),
|
|
478
620
|
// });
|
|
479
621
|
// const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -582,7 +724,7 @@ var generator2 = () => ({
|
|
|
582
724
|
canvasModel.builder.call((builder) => {
|
|
583
725
|
const triggerShape = createTrigger({
|
|
584
726
|
spaceId: space.id,
|
|
585
|
-
triggerKind:
|
|
727
|
+
triggerKind: "timer",
|
|
586
728
|
...position({
|
|
587
729
|
x: -10,
|
|
588
730
|
y: -5
|
|
@@ -718,7 +860,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
718
860
|
const triggerSpec = functionTrigger.spec;
|
|
719
861
|
invariant(triggerSpec && triggerSpec.kind === triggerKind, "No trigger spec.", {
|
|
720
862
|
F: __dxlog_file,
|
|
721
|
-
L:
|
|
863
|
+
L: 675,
|
|
722
864
|
S: void 0,
|
|
723
865
|
A: [
|
|
724
866
|
"triggerSpec && triggerSpec.kind === triggerKind",
|
|
@@ -731,7 +873,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
731
873
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
732
874
|
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
733
875
|
F: __dxlog_file,
|
|
734
|
-
L:
|
|
876
|
+
L: 682,
|
|
735
877
|
S: void 0,
|
|
736
878
|
A: [
|
|
737
879
|
"templateComputeNode",
|
|
@@ -755,9 +897,9 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
755
897
|
};
|
|
756
898
|
};
|
|
757
899
|
var addToSpace = (name, space, canvas, compute) => {
|
|
758
|
-
return space.db.add(
|
|
900
|
+
return space.db.add(Obj.make(CanvasBoardType, {
|
|
759
901
|
name,
|
|
760
|
-
computeGraph:
|
|
902
|
+
computeGraph: Ref.make(compute.root),
|
|
761
903
|
layout: canvas.graph
|
|
762
904
|
}));
|
|
763
905
|
};
|
|
@@ -793,14 +935,14 @@ var setupQueue = (space, canvasModel, args) => {
|
|
|
793
935
|
var attachTrigger = (functionTrigger, computeModel) => {
|
|
794
936
|
invariant(functionTrigger, void 0, {
|
|
795
937
|
F: __dxlog_file,
|
|
796
|
-
L:
|
|
938
|
+
L: 721,
|
|
797
939
|
S: void 0,
|
|
798
940
|
A: [
|
|
799
941
|
"functionTrigger",
|
|
800
942
|
""
|
|
801
943
|
]
|
|
802
944
|
});
|
|
803
|
-
functionTrigger.function =
|
|
945
|
+
functionTrigger.function = Ref.make(computeModel.root);
|
|
804
946
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT2);
|
|
805
947
|
functionTrigger.inputNodeId = inputNode.id;
|
|
806
948
|
};
|
|
@@ -848,6 +990,36 @@ var position = (rect) => {
|
|
|
848
990
|
}
|
|
849
991
|
};
|
|
850
992
|
|
|
993
|
+
// src/components/SpaceGenerator/SchemaTable.tsx
|
|
994
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
995
|
+
import React from "react";
|
|
996
|
+
import { IconButton } from "@dxos/react-ui";
|
|
997
|
+
var SchemaTable = ({ types, objects = {}, label, onClick }) => {
|
|
998
|
+
var _effect = _useSignals();
|
|
999
|
+
try {
|
|
1000
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1001
|
+
className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
|
|
1002
|
+
}, /* @__PURE__ */ React.createElement("h2", {
|
|
1003
|
+
className: "p-2"
|
|
1004
|
+
}, label), types.map((type) => /* @__PURE__ */ React.createElement("div", {
|
|
1005
|
+
key: type.typename,
|
|
1006
|
+
className: "grid grid-cols-subgrid col-span-3 items-center"
|
|
1007
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1008
|
+
className: "pli-2 text-sm font-mono text-subdued"
|
|
1009
|
+
}, type.typename), /* @__PURE__ */ React.createElement("div", {
|
|
1010
|
+
className: "pli-2 text-right font-mono"
|
|
1011
|
+
}, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
|
|
1012
|
+
variant: "ghost",
|
|
1013
|
+
icon: "ph--plus--regular",
|
|
1014
|
+
iconOnly: true,
|
|
1015
|
+
label: "Create data",
|
|
1016
|
+
onClick: () => onClick(type.typename)
|
|
1017
|
+
}))));
|
|
1018
|
+
} finally {
|
|
1019
|
+
_effect.f();
|
|
1020
|
+
}
|
|
1021
|
+
};
|
|
1022
|
+
|
|
851
1023
|
// src/components/SpaceGenerator/SpaceGenerator.tsx
|
|
852
1024
|
var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
853
1025
|
var _effect = _useSignals2();
|
|
@@ -855,16 +1027,15 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
855
1027
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
856
1028
|
const client = useClient();
|
|
857
1029
|
const staticTypes = [
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
1030
|
+
Markdown3.Document,
|
|
1031
|
+
Diagram2.Diagram,
|
|
1032
|
+
Sheet2.Sheet,
|
|
861
1033
|
ComputeGraph2
|
|
862
1034
|
];
|
|
863
1035
|
const recordTypes = [
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
DataType2.Message
|
|
1036
|
+
Organization2.Organization,
|
|
1037
|
+
Person2.Person,
|
|
1038
|
+
Task.Task
|
|
868
1039
|
];
|
|
869
1040
|
const [count, setCount] = useState(1);
|
|
870
1041
|
const [info, setInfo] = useState({});
|
|
@@ -891,9 +1062,9 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
891
1062
|
const updateInfo = async () => {
|
|
892
1063
|
const echoSchema = await space.db.schemaRegistry.query().run();
|
|
893
1064
|
const staticSchema = space.db.graph.schemaRegistry.schemas;
|
|
894
|
-
const { objects } = await space.db.query(
|
|
1065
|
+
const { objects } = await space.db.query(Filter3.everything()).run();
|
|
895
1066
|
const objectMap = sortKeys(objects.reduce((map, obj) => {
|
|
896
|
-
const type = getTypename(obj);
|
|
1067
|
+
const type = Obj2.getTypename(obj);
|
|
897
1068
|
if (type) {
|
|
898
1069
|
const count2 = map[type] ?? 0;
|
|
899
1070
|
map[type] = count2 + 1;
|
|
@@ -960,8 +1131,8 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
960
1131
|
label: "Presets",
|
|
961
1132
|
onClick: handleCreateData
|
|
962
1133
|
}), /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
|
|
963
|
-
|
|
964
|
-
|
|
1134
|
+
language: "json",
|
|
1135
|
+
classNames: "text-xs"
|
|
965
1136
|
}, JSON.stringify({
|
|
966
1137
|
space,
|
|
967
1138
|
...info
|
|
@@ -978,4 +1149,4 @@ var SpaceGenerator_default = SpaceGenerator;
|
|
|
978
1149
|
export {
|
|
979
1150
|
SpaceGenerator_default as default
|
|
980
1151
|
};
|
|
981
|
-
//# sourceMappingURL=SpaceGenerator-
|
|
1152
|
+
//# sourceMappingURL=SpaceGenerator-BED4UXGS.mjs.map
|