@dxos/plugin-debug 0.8.4-main.2e9d522 → 0.8.4-main.3c1ae3b
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-AG3XGNMV.mjs → SpaceGenerator-GYCIEMMO.mjs} +274 -99
- package/dist/lib/browser/SpaceGenerator-GYCIEMMO.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-3GD2OWCA.mjs → react-surface-RFG63TTF.mjs} +104 -98
- package/dist/lib/browser/react-surface-RFG63TTF.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 +4 -4
- 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 +2 -2
- 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 +68 -64
- 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 +29 -36
- package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +11 -11
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +20 -16
- package/src/components/SpaceGenerator/draw-util.ts +5 -5
- package/src/components/SpaceGenerator/presets.ts +200 -21
- package/src/components/Wireframe.tsx +5 -5
- 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-AG3XGNMV.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-3GD2OWCA.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,54 @@
|
|
|
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 {
|
|
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
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import { CanvasType, DiagramType } from "@dxos/plugin-sketch/types";
|
|
20
|
+
import { DXN, Filter, Key } from "@dxos/echo";
|
|
21
|
+
import { Markdown } from "@dxos/plugin-markdown/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
|
|
36
|
+
const views = await space.db.query(Filter.type(View.View)).run();
|
|
39
37
|
const view = await findViewByTypename(views, typename);
|
|
40
|
-
const staticSchema = client?.graph.schemaRegistry.
|
|
38
|
+
const staticSchema = client?.graph.schemaRegistry.query({
|
|
39
|
+
typename
|
|
40
|
+
}).runSync()[0];
|
|
41
41
|
if (!view && !staticSchema) {
|
|
42
42
|
await dispatch(createIntent(SpaceAction.AddSchema, {
|
|
43
43
|
space,
|
|
44
|
-
schema
|
|
44
|
+
schema,
|
|
45
|
+
show: false
|
|
45
46
|
}));
|
|
46
47
|
} else if (!view && staticSchema) {
|
|
47
48
|
await dispatch(createIntent(SpaceAction.UseStaticSchema, {
|
|
48
49
|
space,
|
|
49
|
-
typename
|
|
50
|
+
typename,
|
|
51
|
+
show: false
|
|
50
52
|
}));
|
|
51
53
|
}
|
|
52
54
|
const generate = createAsyncGenerator(generator, schema, {
|
|
@@ -57,14 +59,12 @@ var createGenerator = (client, dispatch, schema) => {
|
|
|
57
59
|
};
|
|
58
60
|
var staticGenerators = /* @__PURE__ */ new Map([
|
|
59
61
|
[
|
|
60
|
-
|
|
62
|
+
Markdown.Document.typename,
|
|
61
63
|
async (space, n, cb) => {
|
|
62
64
|
const objects = range(n).map(() => {
|
|
63
|
-
return space.db.add(
|
|
65
|
+
return space.db.add(Markdown.make({
|
|
64
66
|
name: faker.commerce.productName(),
|
|
65
|
-
content:
|
|
66
|
-
content: faker.lorem.sentences(5)
|
|
67
|
-
}))
|
|
67
|
+
content: faker.lorem.sentences(5)
|
|
68
68
|
}));
|
|
69
69
|
});
|
|
70
70
|
cb?.(objects);
|
|
@@ -72,14 +72,11 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
72
72
|
}
|
|
73
73
|
],
|
|
74
74
|
[
|
|
75
|
-
|
|
75
|
+
Diagram.Diagram.typename,
|
|
76
76
|
async (space, n, cb) => {
|
|
77
77
|
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
|
-
}))
|
|
78
|
+
const obj = space.db.add(Diagram.make({
|
|
79
|
+
name: faker.commerce.productName()
|
|
83
80
|
}));
|
|
84
81
|
return obj;
|
|
85
82
|
});
|
|
@@ -89,7 +86,7 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
89
86
|
],
|
|
90
87
|
// TODO(burdon): Create unit tests.
|
|
91
88
|
[
|
|
92
|
-
|
|
89
|
+
Sheet.Sheet.typename,
|
|
93
90
|
async (space, n, cb) => {
|
|
94
91
|
const objects = range(n).map(() => {
|
|
95
92
|
const cells = {};
|
|
@@ -125,7 +122,7 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
125
122
|
}
|
|
126
123
|
}
|
|
127
124
|
}
|
|
128
|
-
return space.db.add(
|
|
125
|
+
return space.db.add(Sheet.make({
|
|
129
126
|
name: faker.commerce.productName(),
|
|
130
127
|
cells
|
|
131
128
|
}));
|
|
@@ -198,64 +195,209 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
198
195
|
]
|
|
199
196
|
]);
|
|
200
197
|
|
|
201
|
-
// src/components/SpaceGenerator/SchemaTable.tsx
|
|
202
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
203
|
-
import React from "react";
|
|
204
|
-
import { IconButton } from "@dxos/react-ui";
|
|
205
|
-
var SchemaTable = ({ types, objects = {}, label, onClick }) => {
|
|
206
|
-
var _effect = _useSignals();
|
|
207
|
-
try {
|
|
208
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
209
|
-
className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
|
|
210
|
-
}, /* @__PURE__ */ React.createElement("h2", {
|
|
211
|
-
className: "p-2"
|
|
212
|
-
}, label), types.map((type) => /* @__PURE__ */ React.createElement("div", {
|
|
213
|
-
key: type.typename,
|
|
214
|
-
className: "grid grid-cols-subgrid col-span-3 items-center"
|
|
215
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
216
|
-
className: "px-2 text-sm font-mono text-subdued"
|
|
217
|
-
}, type.typename), /* @__PURE__ */ React.createElement("div", {
|
|
218
|
-
className: "px-2 text-right font-mono"
|
|
219
|
-
}, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
|
|
220
|
-
variant: "ghost",
|
|
221
|
-
icon: "ph--plus--regular",
|
|
222
|
-
iconOnly: true,
|
|
223
|
-
label: "Create data",
|
|
224
|
-
onClick: () => onClick(type.typename)
|
|
225
|
-
}))));
|
|
226
|
-
} finally {
|
|
227
|
-
_effect.f();
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
|
|
231
198
|
// src/components/SpaceGenerator/presets.ts
|
|
232
|
-
import
|
|
199
|
+
import * as Schema from "effect/Schema";
|
|
200
|
+
import { Agent, EntityExtraction, ResearchBlueprint } from "@dxos/assistant-toolkit";
|
|
201
|
+
import { Prompt } from "@dxos/blueprints";
|
|
233
202
|
import { NODE_INPUT as NODE_INPUT2 } from "@dxos/conductor";
|
|
234
|
-
import { DXN as DXN2, Key as Key2, Obj
|
|
235
|
-
import {
|
|
203
|
+
import { DXN as DXN2, Filter as Filter2, Key as Key2, Obj, Query, Ref, Tag, Type } from "@dxos/echo";
|
|
204
|
+
import { Trigger, serializeFunction } from "@dxos/functions";
|
|
236
205
|
import { invariant } from "@dxos/invariant";
|
|
237
|
-
import {
|
|
206
|
+
import { gmail } from "@dxos/plugin-inbox";
|
|
207
|
+
import { Mailbox } from "@dxos/plugin-inbox/types";
|
|
208
|
+
import { Markdown as Markdown2 } from "@dxos/plugin-markdown/types";
|
|
209
|
+
import { createAppend, createChat, createComputeGraph, createConstant, createFunction, createGpt, createQueue, createRandom, createSurface, createTemplate, createText, createTrigger } from "@dxos/react-ui-canvas-compute";
|
|
238
210
|
import { CanvasBoardType, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from "@dxos/react-ui-canvas-editor";
|
|
239
|
-
import {
|
|
211
|
+
import { View as View2 } from "@dxos/schema";
|
|
212
|
+
import { Message, Organization, Person, Project } from "@dxos/types";
|
|
213
|
+
import { range as range2, trim } from "@dxos/util";
|
|
240
214
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-debug/src/components/SpaceGenerator/presets.ts";
|
|
241
|
-
var PresetName = /* @__PURE__ */ function(PresetName2) {
|
|
215
|
+
var PresetName = /* @__PURE__ */ (function(PresetName2) {
|
|
216
|
+
PresetName2["DXOS_TEAM"] = "dxos-team";
|
|
217
|
+
PresetName2["ORG_RESEARCH_PROJECT"] = "org-research-project";
|
|
242
218
|
PresetName2["GPT_QUEUE"] = "webhook-gpt-queue";
|
|
243
219
|
PresetName2["CHAT_GPT"] = "chat-gpt-text";
|
|
244
220
|
PresetName2["OBJECT_CHANGE_QUEUE"] = "objectChange-queue";
|
|
245
|
-
PresetName2["FOREX_FUNCTION_CALL"] = "forex-function-call";
|
|
246
221
|
PresetName2["TIMER_TICK_QUEUE"] = "timerTick-queue";
|
|
222
|
+
PresetName2["FOREX_FUNCTION_CALL"] = "forex-function-call";
|
|
247
223
|
PresetName2["DISCORD_MESSAGES"] = "discord-messages";
|
|
248
224
|
return PresetName2;
|
|
249
|
-
}({});
|
|
225
|
+
})({});
|
|
250
226
|
var generator2 = () => ({
|
|
251
227
|
schemas: [
|
|
252
228
|
CanvasBoardType,
|
|
253
|
-
|
|
229
|
+
Trigger.Trigger
|
|
254
230
|
],
|
|
255
231
|
types: Object.values(PresetName).map((name) => ({
|
|
256
232
|
typename: name
|
|
257
233
|
})),
|
|
258
234
|
items: [
|
|
235
|
+
[
|
|
236
|
+
"dxos-team",
|
|
237
|
+
async (space, n, cb) => {
|
|
238
|
+
const objects = range2(n, () => {
|
|
239
|
+
const org = space.db.add(Obj.make(Organization.Organization, {
|
|
240
|
+
name: "DXOS",
|
|
241
|
+
website: "https://dxos.org"
|
|
242
|
+
}));
|
|
243
|
+
const doc = space.db.add(Markdown2.make({
|
|
244
|
+
name: "DXOS Research",
|
|
245
|
+
content: "DXOS builds Composer, an open-source AI-powered malleable application."
|
|
246
|
+
}));
|
|
247
|
+
const tag = space.db.add(Tag.make({
|
|
248
|
+
label: "Investor"
|
|
249
|
+
}));
|
|
250
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
251
|
+
Obj.getMeta(doc).tags = [
|
|
252
|
+
tagDxn
|
|
253
|
+
];
|
|
254
|
+
space.db.add(Obj.make(Person.Person, {
|
|
255
|
+
fullName: "Rich",
|
|
256
|
+
organization: Ref.make(org)
|
|
257
|
+
}, {
|
|
258
|
+
tags: [
|
|
259
|
+
tagDxn
|
|
260
|
+
]
|
|
261
|
+
}));
|
|
262
|
+
space.db.add(Obj.make(Person.Person, {
|
|
263
|
+
fullName: "Josiah",
|
|
264
|
+
organization: Ref.make(org)
|
|
265
|
+
}));
|
|
266
|
+
space.db.add(Obj.make(Person.Person, {
|
|
267
|
+
fullName: "Dima",
|
|
268
|
+
organization: Ref.make(org)
|
|
269
|
+
}));
|
|
270
|
+
space.db.add(Obj.make(Person.Person, {
|
|
271
|
+
fullName: "Mykola",
|
|
272
|
+
organization: Ref.make(org)
|
|
273
|
+
}));
|
|
274
|
+
return doc;
|
|
275
|
+
});
|
|
276
|
+
cb?.(objects);
|
|
277
|
+
return objects;
|
|
278
|
+
}
|
|
279
|
+
],
|
|
280
|
+
[
|
|
281
|
+
"org-research-project",
|
|
282
|
+
async (space, n, cb) => {
|
|
283
|
+
const mailbox = await space.db.query(Filter2.type(Mailbox.Mailbox)).first();
|
|
284
|
+
const tag = await space.db.query(Filter2.type(Tag.Tag, {
|
|
285
|
+
label: "Investor"
|
|
286
|
+
})).first();
|
|
287
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
288
|
+
const objects = range2(n, () => {
|
|
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));
|
|
291
|
+
const notesQuery = Query.select(Filter2.type(Markdown2.Document)).select(Filter2.tag(tagDxn));
|
|
292
|
+
space.db.add(Trigger.make({
|
|
293
|
+
enabled: true,
|
|
294
|
+
spec: {
|
|
295
|
+
kind: "timer",
|
|
296
|
+
cron: "* * * * *"
|
|
297
|
+
},
|
|
298
|
+
function: Ref.make(serializeFunction(gmail.sync)),
|
|
299
|
+
input: {
|
|
300
|
+
mailboxId: Obj.getDXN(mailbox).toString()
|
|
301
|
+
}
|
|
302
|
+
}));
|
|
303
|
+
space.db.add(Trigger.make({
|
|
304
|
+
enabled: true,
|
|
305
|
+
// TODO(wittjosiah): Queue trigger doesn't support matching query of the column.
|
|
306
|
+
spec: {
|
|
307
|
+
kind: "queue",
|
|
308
|
+
queue: mailbox.queue.dxn.toString()
|
|
309
|
+
},
|
|
310
|
+
function: Ref.make(serializeFunction(EntityExtraction.extract)),
|
|
311
|
+
input: {
|
|
312
|
+
source: "{{event.item}}"
|
|
313
|
+
}
|
|
314
|
+
}));
|
|
315
|
+
const researchPrompt = space.db.add(Prompt.make({
|
|
316
|
+
name: "Research",
|
|
317
|
+
description: "Research organization",
|
|
318
|
+
input: Schema.Struct({
|
|
319
|
+
org: Schema.Any
|
|
320
|
+
}),
|
|
321
|
+
output: Schema.Any,
|
|
322
|
+
// TODO(dmaretskyi): This mocks research (returns pre-baked result), the actual research might take compute minutes.
|
|
323
|
+
// Remove the mock prompt to do the actual research.
|
|
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
|
+
`,
|
|
329
|
+
blueprints: [
|
|
330
|
+
Ref.make(ResearchBlueprint)
|
|
331
|
+
]
|
|
332
|
+
}));
|
|
333
|
+
space.db.add(Trigger.make({
|
|
334
|
+
enabled: true,
|
|
335
|
+
spec: {
|
|
336
|
+
kind: "subscription",
|
|
337
|
+
query: {
|
|
338
|
+
ast: organizationsQuery.ast
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
function: Ref.make(serializeFunction(Agent.prompt)),
|
|
342
|
+
input: {
|
|
343
|
+
prompt: Ref.make(researchPrompt),
|
|
344
|
+
input: "{{event.subject}}"
|
|
345
|
+
}
|
|
346
|
+
}));
|
|
347
|
+
const mailboxView = View2.make({
|
|
348
|
+
query: Query.select(Filter2.type(Message.Message, {
|
|
349
|
+
properties: {
|
|
350
|
+
labels: Filter2.contains("investor")
|
|
351
|
+
}
|
|
352
|
+
})).options({
|
|
353
|
+
queues: [
|
|
354
|
+
mailbox.queue.dxn.toString()
|
|
355
|
+
]
|
|
356
|
+
}),
|
|
357
|
+
jsonSchema: Type.toJsonSchema(Message.Message)
|
|
358
|
+
});
|
|
359
|
+
const contactsView = View2.make({
|
|
360
|
+
query: contactsQuery,
|
|
361
|
+
jsonSchema: Type.toJsonSchema(Person.Person)
|
|
362
|
+
});
|
|
363
|
+
const organizationsView = View2.make({
|
|
364
|
+
query: organizationsQuery,
|
|
365
|
+
jsonSchema: Type.toJsonSchema(Organization.Organization)
|
|
366
|
+
});
|
|
367
|
+
const notesView = View2.make({
|
|
368
|
+
query: notesQuery,
|
|
369
|
+
jsonSchema: Type.toJsonSchema(Markdown2.Document)
|
|
370
|
+
});
|
|
371
|
+
return space.db.add(Project.make({
|
|
372
|
+
name: "Investor Research",
|
|
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
|
+
]
|
|
395
|
+
}));
|
|
396
|
+
});
|
|
397
|
+
cb?.(objects.flat());
|
|
398
|
+
return objects.flat();
|
|
399
|
+
}
|
|
400
|
+
],
|
|
259
401
|
[
|
|
260
402
|
"webhook-gpt-queue",
|
|
261
403
|
async (space, n, cb) => {
|
|
@@ -269,7 +411,7 @@ var generator2 = () => ({
|
|
|
269
411
|
})));
|
|
270
412
|
const triggerShape = createTrigger({
|
|
271
413
|
spaceId: space.id,
|
|
272
|
-
triggerKind:
|
|
414
|
+
triggerKind: "webhook",
|
|
273
415
|
...position({
|
|
274
416
|
x: -18,
|
|
275
417
|
y: -2
|
|
@@ -320,8 +462,8 @@ var generator2 = () => ({
|
|
|
320
462
|
"objectChange-queue",
|
|
321
463
|
async (space, n, cb) => {
|
|
322
464
|
const objects = range2(n, () => {
|
|
323
|
-
const { canvasModel, computeModel } = createQueueSinkPreset(space,
|
|
324
|
-
|
|
465
|
+
const { canvasModel, computeModel } = createQueueSinkPreset(space, "subscription", (triggerSpec) => triggerSpec.query = {
|
|
466
|
+
ast: Query.select(Filter2.typename("dxos.org/type/Chess")).ast
|
|
325
467
|
}, "type");
|
|
326
468
|
return addToSpace("objectChange-queue", space, canvasModel, computeModel);
|
|
327
469
|
});
|
|
@@ -333,7 +475,7 @@ var generator2 = () => ({
|
|
|
333
475
|
"timerTick-queue",
|
|
334
476
|
async (space, n, cb) => {
|
|
335
477
|
const objects = range2(n, () => {
|
|
336
|
-
const { canvasModel, computeModel } = createQueueSinkPreset(space,
|
|
478
|
+
const { canvasModel, computeModel } = createQueueSinkPreset(space, "timer", (triggerSpec) => triggerSpec.cron = "*/5 * * * * *", "result");
|
|
337
479
|
return addToSpace("timerTick-queue", space, canvasModel, computeModel);
|
|
338
480
|
});
|
|
339
481
|
cb?.(objects);
|
|
@@ -360,7 +502,7 @@ var generator2 = () => ({
|
|
|
360
502
|
// canvasModel.builder.call((builder) => {
|
|
361
503
|
// const triggerShape = createTrigger({
|
|
362
504
|
// spaceId: space.id,
|
|
363
|
-
// triggerKind:
|
|
505
|
+
// triggerKind: 'email',
|
|
364
506
|
// ...position({ x: -18, y: -2 }),
|
|
365
507
|
// });
|
|
366
508
|
// const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -475,7 +617,7 @@ var generator2 = () => ({
|
|
|
475
617
|
// );
|
|
476
618
|
// const triggerShape = createTrigger({
|
|
477
619
|
// spaceId: space.id,
|
|
478
|
-
// triggerKind:
|
|
620
|
+
// triggerKind: 'email',
|
|
479
621
|
// ...rawPosition({ centerX: -736, centerY: -384, width: 182, height: 192 }),
|
|
480
622
|
// });
|
|
481
623
|
// const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -584,7 +726,7 @@ var generator2 = () => ({
|
|
|
584
726
|
canvasModel.builder.call((builder) => {
|
|
585
727
|
const triggerShape = createTrigger({
|
|
586
728
|
spaceId: space.id,
|
|
587
|
-
triggerKind:
|
|
729
|
+
triggerKind: "timer",
|
|
588
730
|
...position({
|
|
589
731
|
x: -10,
|
|
590
732
|
y: -5
|
|
@@ -720,7 +862,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
720
862
|
const triggerSpec = functionTrigger.spec;
|
|
721
863
|
invariant(triggerSpec && triggerSpec.kind === triggerKind, "No trigger spec.", {
|
|
722
864
|
F: __dxlog_file,
|
|
723
|
-
L:
|
|
865
|
+
L: 675,
|
|
724
866
|
S: void 0,
|
|
725
867
|
A: [
|
|
726
868
|
"triggerSpec && triggerSpec.kind === triggerKind",
|
|
@@ -733,7 +875,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
733
875
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
734
876
|
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
735
877
|
F: __dxlog_file,
|
|
736
|
-
L:
|
|
878
|
+
L: 682,
|
|
737
879
|
S: void 0,
|
|
738
880
|
A: [
|
|
739
881
|
"templateComputeNode",
|
|
@@ -746,7 +888,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
746
888
|
' "id": "@{{changeId}}"',
|
|
747
889
|
"}"
|
|
748
890
|
].join("\n");
|
|
749
|
-
templateComputeNode.inputSchema =
|
|
891
|
+
templateComputeNode.inputSchema = Type.toJsonSchema(Schema.Struct({
|
|
750
892
|
type: Schema.String,
|
|
751
893
|
changeId: Schema.String
|
|
752
894
|
}));
|
|
@@ -757,9 +899,9 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
757
899
|
};
|
|
758
900
|
};
|
|
759
901
|
var addToSpace = (name, space, canvas, compute) => {
|
|
760
|
-
return space.db.add(
|
|
902
|
+
return space.db.add(Obj.make(CanvasBoardType, {
|
|
761
903
|
name,
|
|
762
|
-
computeGraph:
|
|
904
|
+
computeGraph: Ref.make(compute.root),
|
|
763
905
|
layout: canvas.graph
|
|
764
906
|
}));
|
|
765
907
|
};
|
|
@@ -795,14 +937,14 @@ var setupQueue = (space, canvasModel, args) => {
|
|
|
795
937
|
var attachTrigger = (functionTrigger, computeModel) => {
|
|
796
938
|
invariant(functionTrigger, void 0, {
|
|
797
939
|
F: __dxlog_file,
|
|
798
|
-
L:
|
|
940
|
+
L: 721,
|
|
799
941
|
S: void 0,
|
|
800
942
|
A: [
|
|
801
943
|
"functionTrigger",
|
|
802
944
|
""
|
|
803
945
|
]
|
|
804
946
|
});
|
|
805
|
-
functionTrigger.function =
|
|
947
|
+
functionTrigger.function = Ref.make(computeModel.root);
|
|
806
948
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT2);
|
|
807
949
|
functionTrigger.inputNodeId = inputNode.id;
|
|
808
950
|
};
|
|
@@ -850,6 +992,36 @@ var position = (rect) => {
|
|
|
850
992
|
}
|
|
851
993
|
};
|
|
852
994
|
|
|
995
|
+
// src/components/SpaceGenerator/SchemaTable.tsx
|
|
996
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
997
|
+
import React from "react";
|
|
998
|
+
import { IconButton } from "@dxos/react-ui";
|
|
999
|
+
var SchemaTable = ({ types, objects = {}, label, onClick }) => {
|
|
1000
|
+
var _effect = _useSignals();
|
|
1001
|
+
try {
|
|
1002
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1003
|
+
className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
|
|
1004
|
+
}, /* @__PURE__ */ React.createElement("h2", {
|
|
1005
|
+
className: "p-2"
|
|
1006
|
+
}, label), types.map((type) => /* @__PURE__ */ React.createElement("div", {
|
|
1007
|
+
key: type.typename,
|
|
1008
|
+
className: "grid grid-cols-subgrid col-span-3 items-center"
|
|
1009
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1010
|
+
className: "pli-2 text-sm font-mono text-subdued"
|
|
1011
|
+
}, type.typename), /* @__PURE__ */ React.createElement("div", {
|
|
1012
|
+
className: "pli-2 text-right font-mono"
|
|
1013
|
+
}, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
|
|
1014
|
+
variant: "ghost",
|
|
1015
|
+
icon: "ph--plus--regular",
|
|
1016
|
+
iconOnly: true,
|
|
1017
|
+
label: "Create data",
|
|
1018
|
+
onClick: () => onClick(type.typename)
|
|
1019
|
+
}))));
|
|
1020
|
+
} finally {
|
|
1021
|
+
_effect.f();
|
|
1022
|
+
}
|
|
1023
|
+
};
|
|
1024
|
+
|
|
853
1025
|
// src/components/SpaceGenerator/SpaceGenerator.tsx
|
|
854
1026
|
var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
855
1027
|
var _effect = _useSignals2();
|
|
@@ -857,26 +1029,29 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
857
1029
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
858
1030
|
const client = useClient();
|
|
859
1031
|
const staticTypes = [
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
1032
|
+
Markdown3.Document,
|
|
1033
|
+
Diagram2.Diagram,
|
|
1034
|
+
Sheet2.Sheet,
|
|
863
1035
|
ComputeGraph2
|
|
864
1036
|
];
|
|
865
1037
|
const recordTypes = [
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
DataType2.Message
|
|
1038
|
+
Organization2.Organization,
|
|
1039
|
+
Person2.Person,
|
|
1040
|
+
Task.Task
|
|
870
1041
|
];
|
|
871
1042
|
const [count, setCount] = useState(1);
|
|
872
1043
|
const [info, setInfo] = useState({});
|
|
873
1044
|
const presets = useMemo(() => generator2(), []);
|
|
874
|
-
|
|
875
|
-
client.addTypes([
|
|
1045
|
+
useAsyncEffect(async () => {
|
|
1046
|
+
await client.addTypes([
|
|
876
1047
|
...staticTypes,
|
|
877
1048
|
...recordTypes,
|
|
878
1049
|
...presets.schemas
|
|
879
1050
|
]);
|
|
1051
|
+
}, [
|
|
1052
|
+
client
|
|
1053
|
+
]);
|
|
1054
|
+
const typeMap = useMemo(() => {
|
|
880
1055
|
const recordGenerators = new Map(recordTypes.map((type) => [
|
|
881
1056
|
type.typename,
|
|
882
1057
|
createGenerator(client, dispatch, type)
|
|
@@ -893,9 +1068,9 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
893
1068
|
const updateInfo = async () => {
|
|
894
1069
|
const echoSchema = await space.db.schemaRegistry.query().run();
|
|
895
1070
|
const staticSchema = space.db.graph.schemaRegistry.schemas;
|
|
896
|
-
const
|
|
1071
|
+
const objects = await space.db.query(Filter3.everything()).run();
|
|
897
1072
|
const objectMap = sortKeys(objects.reduce((map, obj) => {
|
|
898
|
-
const type = getTypename(obj);
|
|
1073
|
+
const type = Obj2.getTypename(obj);
|
|
899
1074
|
if (type) {
|
|
900
1075
|
const count2 = map[type] ?? 0;
|
|
901
1076
|
map[type] = count2 + 1;
|
|
@@ -962,8 +1137,8 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
962
1137
|
label: "Presets",
|
|
963
1138
|
onClick: handleCreateData
|
|
964
1139
|
}), /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
|
|
965
|
-
|
|
966
|
-
|
|
1140
|
+
language: "json",
|
|
1141
|
+
classNames: "text-xs"
|
|
967
1142
|
}, JSON.stringify({
|
|
968
1143
|
space,
|
|
969
1144
|
...info
|
|
@@ -980,4 +1155,4 @@ var SpaceGenerator_default = SpaceGenerator;
|
|
|
980
1155
|
export {
|
|
981
1156
|
SpaceGenerator_default as default
|
|
982
1157
|
};
|
|
983
|
-
//# sourceMappingURL=SpaceGenerator-
|
|
1158
|
+
//# sourceMappingURL=SpaceGenerator-GYCIEMMO.mjs.map
|