@dxos/plugin-debug 0.8.4-main.2e9d522 → 0.8.4-main.548089c
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-IFOX6XDJ.mjs} +269 -92
- package/dist/lib/browser/SpaceGenerator-IFOX6XDJ.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-SQXFD2BL.mjs → app-graph-builder-TWGU6RNG.mjs} +76 -85
- package/dist/lib/browser/app-graph-builder-TWGU6RNG.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-3GD2OWCA.mjs → react-surface-3OFB22IR.mjs} +104 -98
- package/dist/lib/browser/react-surface-3OFB22IR.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 +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 +68 -64
- package/src/DebugPlugin.tsx +6 -7
- package/src/capabilities/app-graph-builder.ts +67 -93
- 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 +24 -30
- package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +11 -11
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +11 -11
- package/src/components/SpaceGenerator/draw-util.ts +5 -5
- package/src/components/SpaceGenerator/presets.ts +184 -20
- package/src/components/Wireframe.tsx +4 -4
- 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-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,53 @@
|
|
|
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 } 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 {
|
|
14
|
+
import { Organization as Organization2, Person as Person2, Task } from "@dxos/types";
|
|
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,
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import { CanvasType, DiagramType } from "@dxos/plugin-sketch/types";
|
|
21
|
+
import { DXN, Filter, Key, Type } from "@dxos/echo";
|
|
22
|
+
import { Markdown } from "@dxos/plugin-markdown/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 {
|
|
27
|
+
import { View, 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
|
-
const { objects: views } = await space.db.query(Filter.type(
|
|
37
|
+
const { objects: views } = await space.db.query(Filter.type(View.View)).run();
|
|
39
38
|
const view = await findViewByTypename(views, typename);
|
|
40
39
|
const staticSchema = client?.graph.schemaRegistry.schemas.find((schema2) => Type.getTypename(schema2) === typename);
|
|
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, {
|
|
@@ -57,14 +58,12 @@ var createGenerator = (client, dispatch, schema) => {
|
|
|
57
58
|
};
|
|
58
59
|
var staticGenerators = /* @__PURE__ */ new Map([
|
|
59
60
|
[
|
|
60
|
-
|
|
61
|
+
Markdown.Document.typename,
|
|
61
62
|
async (space, n, cb) => {
|
|
62
63
|
const objects = range(n).map(() => {
|
|
63
|
-
return space.db.add(
|
|
64
|
+
return space.db.add(Markdown.make({
|
|
64
65
|
name: faker.commerce.productName(),
|
|
65
|
-
content:
|
|
66
|
-
content: faker.lorem.sentences(5)
|
|
67
|
-
}))
|
|
66
|
+
content: faker.lorem.sentences(5)
|
|
68
67
|
}));
|
|
69
68
|
});
|
|
70
69
|
cb?.(objects);
|
|
@@ -72,14 +71,11 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
72
71
|
}
|
|
73
72
|
],
|
|
74
73
|
[
|
|
75
|
-
|
|
74
|
+
Diagram.Diagram.typename,
|
|
76
75
|
async (space, n, cb) => {
|
|
77
76
|
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
|
-
}))
|
|
77
|
+
const obj = space.db.add(Diagram.make({
|
|
78
|
+
name: faker.commerce.productName()
|
|
83
79
|
}));
|
|
84
80
|
return obj;
|
|
85
81
|
});
|
|
@@ -89,7 +85,7 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
89
85
|
],
|
|
90
86
|
// TODO(burdon): Create unit tests.
|
|
91
87
|
[
|
|
92
|
-
|
|
88
|
+
Sheet.Sheet.typename,
|
|
93
89
|
async (space, n, cb) => {
|
|
94
90
|
const objects = range(n).map(() => {
|
|
95
91
|
const cells = {};
|
|
@@ -125,7 +121,7 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
125
121
|
}
|
|
126
122
|
}
|
|
127
123
|
}
|
|
128
|
-
return space.db.add(
|
|
124
|
+
return space.db.add(Sheet.make({
|
|
129
125
|
name: faker.commerce.productName(),
|
|
130
126
|
cells
|
|
131
127
|
}));
|
|
@@ -198,47 +194,26 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
198
194
|
]
|
|
199
195
|
]);
|
|
200
196
|
|
|
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
197
|
// src/components/SpaceGenerator/presets.ts
|
|
232
|
-
import
|
|
198
|
+
import * as Schema from "effect/Schema";
|
|
199
|
+
import { Agent, EntityExtraction, ResearchBlueprint } from "@dxos/assistant-toolkit";
|
|
200
|
+
import { Prompt } from "@dxos/blueprints";
|
|
233
201
|
import { NODE_INPUT as NODE_INPUT2 } from "@dxos/conductor";
|
|
234
|
-
import { DXN as DXN2, Key as Key2, Obj
|
|
235
|
-
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";
|
|
236
204
|
import { invariant } from "@dxos/invariant";
|
|
237
|
-
import {
|
|
205
|
+
import { email } 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";
|
|
238
209
|
import { CanvasBoardType, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from "@dxos/react-ui-canvas-editor";
|
|
239
|
-
import {
|
|
210
|
+
import { Collection, View as View2 } from "@dxos/schema";
|
|
211
|
+
import { Message, Organization, Person, Project } from "@dxos/types";
|
|
212
|
+
import { range as range2, trim } from "@dxos/util";
|
|
240
213
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-debug/src/components/SpaceGenerator/presets.ts";
|
|
241
|
-
var PresetName = /* @__PURE__ */ function(PresetName2) {
|
|
214
|
+
var PresetName = /* @__PURE__ */ (function(PresetName2) {
|
|
215
|
+
PresetName2["DXOS_TEAM"] = "dxos-team";
|
|
216
|
+
PresetName2["ORG_RESEARCH_PROJECT"] = "org-research-project";
|
|
242
217
|
PresetName2["GPT_QUEUE"] = "webhook-gpt-queue";
|
|
243
218
|
PresetName2["CHAT_GPT"] = "chat-gpt-text";
|
|
244
219
|
PresetName2["OBJECT_CHANGE_QUEUE"] = "objectChange-queue";
|
|
@@ -246,16 +221,189 @@ var PresetName = /* @__PURE__ */ function(PresetName2) {
|
|
|
246
221
|
PresetName2["TIMER_TICK_QUEUE"] = "timerTick-queue";
|
|
247
222
|
PresetName2["DISCORD_MESSAGES"] = "discord-messages";
|
|
248
223
|
return PresetName2;
|
|
249
|
-
}({});
|
|
224
|
+
})({});
|
|
250
225
|
var generator2 = () => ({
|
|
251
226
|
schemas: [
|
|
252
227
|
CanvasBoardType,
|
|
253
|
-
|
|
228
|
+
Trigger.Trigger
|
|
254
229
|
],
|
|
255
230
|
types: Object.values(PresetName).map((name) => ({
|
|
256
231
|
typename: name
|
|
257
232
|
})),
|
|
258
233
|
items: [
|
|
234
|
+
[
|
|
235
|
+
"dxos-team",
|
|
236
|
+
async (space, n, cb) => {
|
|
237
|
+
const objects = range2(n, () => {
|
|
238
|
+
const tag = space.db.add(Tag.make({
|
|
239
|
+
label: "Investor"
|
|
240
|
+
}));
|
|
241
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
242
|
+
const org = space.db.add(Obj.make(Organization.Organization, {
|
|
243
|
+
name: "DXOS",
|
|
244
|
+
website: "https://dxos.org"
|
|
245
|
+
}));
|
|
246
|
+
const doc = space.db.add(Markdown2.make({
|
|
247
|
+
name: "DXOS Research",
|
|
248
|
+
content: "DXOS builds Composer, an open-source AI-powered malleable application."
|
|
249
|
+
}));
|
|
250
|
+
Obj.getMeta(doc).tags = [
|
|
251
|
+
tagDxn
|
|
252
|
+
];
|
|
253
|
+
space.db.add(Obj.make(Person.Person, {
|
|
254
|
+
fullName: "Rich",
|
|
255
|
+
organization: Ref.make(org)
|
|
256
|
+
}, {
|
|
257
|
+
tags: [
|
|
258
|
+
tagDxn
|
|
259
|
+
]
|
|
260
|
+
}));
|
|
261
|
+
space.db.add(Obj.make(Person.Person, {
|
|
262
|
+
fullName: "Josiah",
|
|
263
|
+
organization: Ref.make(org)
|
|
264
|
+
}));
|
|
265
|
+
space.db.add(Obj.make(Person.Person, {
|
|
266
|
+
fullName: "Dima",
|
|
267
|
+
organization: Ref.make(org)
|
|
268
|
+
}));
|
|
269
|
+
space.db.add(Obj.make(Person.Person, {
|
|
270
|
+
fullName: "Mykola",
|
|
271
|
+
organization: Ref.make(org)
|
|
272
|
+
}));
|
|
273
|
+
space.db.add(Obj.make(Person.Person, {
|
|
274
|
+
fullName: "Will",
|
|
275
|
+
organization: Ref.make(org)
|
|
276
|
+
}));
|
|
277
|
+
return doc;
|
|
278
|
+
});
|
|
279
|
+
cb?.(objects);
|
|
280
|
+
return objects;
|
|
281
|
+
}
|
|
282
|
+
],
|
|
283
|
+
[
|
|
284
|
+
"org-research-project",
|
|
285
|
+
async (space, n, cb) => {
|
|
286
|
+
const mailbox = await space.db.query(Filter2.type(Mailbox.Mailbox)).first();
|
|
287
|
+
const tag = await space.db.query(Filter2.type(Tag.Tag, {
|
|
288
|
+
label: "Investor"
|
|
289
|
+
})).first();
|
|
290
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
291
|
+
const objects = range2(n, () => {
|
|
292
|
+
const contactsQuery = Query.select(Filter2.type(Person.Person)).select(Filter2.tag(tagDxn));
|
|
293
|
+
const organizationsQuery = Query.select(Filter2.type(Organization.Organization)).select(Filter2.tag(tagDxn));
|
|
294
|
+
const notesQuery = Query.select(Filter2.type(Markdown2.Document)).select(Filter2.tag(tagDxn));
|
|
295
|
+
const emailSyncTrigger = Trigger.make({
|
|
296
|
+
enabled: true,
|
|
297
|
+
spec: {
|
|
298
|
+
kind: "timer",
|
|
299
|
+
cron: "* * * * *"
|
|
300
|
+
},
|
|
301
|
+
function: Ref.make(serializeFunction(email.sync)),
|
|
302
|
+
input: {
|
|
303
|
+
mailboxId: Obj.getDXN(mailbox).toString()
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
space.db.add(emailSyncTrigger);
|
|
307
|
+
const contactExtractionTrigger = Trigger.make({
|
|
308
|
+
enabled: true,
|
|
309
|
+
// TODO(wittjosiah): Queue trigger doesn't support matching query of the column.
|
|
310
|
+
spec: {
|
|
311
|
+
kind: "queue",
|
|
312
|
+
queue: mailbox.queue.dxn.toString()
|
|
313
|
+
},
|
|
314
|
+
function: Ref.make(serializeFunction(EntityExtraction.extract)),
|
|
315
|
+
input: {
|
|
316
|
+
source: "{{event.item}}"
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
space.db.add(contactExtractionTrigger);
|
|
320
|
+
const researchPrompt = space.db.add(Prompt.make({
|
|
321
|
+
name: "Research",
|
|
322
|
+
description: "Research organization",
|
|
323
|
+
input: Schema.Struct({
|
|
324
|
+
org: Schema.Any
|
|
325
|
+
}),
|
|
326
|
+
output: Schema.Any,
|
|
327
|
+
// TODO(dmaretskyi): This mocks research (returns pre-baked result), the actual research might take compute minutes.
|
|
328
|
+
// Remove the mock prompt to do the actual research.
|
|
329
|
+
instructions: trim`
|
|
330
|
+
Research the organization provided as input.
|
|
331
|
+
Create a research note for it at the end.
|
|
332
|
+
NOTE: Do mocked reseach (set mockSearch to true).
|
|
333
|
+
`,
|
|
334
|
+
blueprints: [
|
|
335
|
+
Ref.make(ResearchBlueprint)
|
|
336
|
+
]
|
|
337
|
+
}));
|
|
338
|
+
const researchTrigger = Trigger.make({
|
|
339
|
+
enabled: true,
|
|
340
|
+
spec: {
|
|
341
|
+
kind: "subscription",
|
|
342
|
+
query: {
|
|
343
|
+
ast: organizationsQuery.ast
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
function: Ref.make(serializeFunction(Agent.prompt)),
|
|
347
|
+
input: {
|
|
348
|
+
prompt: Ref.make(researchPrompt),
|
|
349
|
+
input: "{{event.subject}}"
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
space.db.add(researchTrigger);
|
|
353
|
+
const mailboxView = View2.make({
|
|
354
|
+
name: "Mailbox",
|
|
355
|
+
query: Query.select(Filter2.type(Message.Message, {
|
|
356
|
+
properties: {
|
|
357
|
+
labels: Filter2.contains("investor")
|
|
358
|
+
}
|
|
359
|
+
})).options({
|
|
360
|
+
queues: [
|
|
361
|
+
mailbox.queue.dxn.toString()
|
|
362
|
+
]
|
|
363
|
+
}),
|
|
364
|
+
jsonSchema: Type2.toJsonSchema(Message.Message),
|
|
365
|
+
presentation: Obj.make(Collection.Collection, {
|
|
366
|
+
objects: []
|
|
367
|
+
})
|
|
368
|
+
});
|
|
369
|
+
const contactsView = View2.make({
|
|
370
|
+
name: "Contacts",
|
|
371
|
+
query: contactsQuery,
|
|
372
|
+
jsonSchema: Type2.toJsonSchema(Person.Person),
|
|
373
|
+
presentation: Obj.make(Collection.Collection, {
|
|
374
|
+
objects: []
|
|
375
|
+
})
|
|
376
|
+
});
|
|
377
|
+
const organizationsView = View2.make({
|
|
378
|
+
name: "Organizations",
|
|
379
|
+
query: organizationsQuery,
|
|
380
|
+
jsonSchema: Type2.toJsonSchema(Organization.Organization),
|
|
381
|
+
presentation: Obj.make(Collection.Collection, {
|
|
382
|
+
objects: []
|
|
383
|
+
})
|
|
384
|
+
});
|
|
385
|
+
const notesView = View2.make({
|
|
386
|
+
name: "Notes",
|
|
387
|
+
query: notesQuery,
|
|
388
|
+
jsonSchema: Type2.toJsonSchema(Markdown2.Document),
|
|
389
|
+
presentation: Obj.make(Collection.Collection, {
|
|
390
|
+
objects: []
|
|
391
|
+
})
|
|
392
|
+
});
|
|
393
|
+
return space.db.add(Project.make({
|
|
394
|
+
name: "Investor Research",
|
|
395
|
+
collections: [
|
|
396
|
+
mailboxView,
|
|
397
|
+
contactsView,
|
|
398
|
+
organizationsView,
|
|
399
|
+
notesView
|
|
400
|
+
].map((view) => Ref.make(view))
|
|
401
|
+
}));
|
|
402
|
+
});
|
|
403
|
+
cb?.(objects.flat());
|
|
404
|
+
return objects.flat();
|
|
405
|
+
}
|
|
406
|
+
],
|
|
259
407
|
[
|
|
260
408
|
"webhook-gpt-queue",
|
|
261
409
|
async (space, n, cb) => {
|
|
@@ -269,7 +417,7 @@ var generator2 = () => ({
|
|
|
269
417
|
})));
|
|
270
418
|
const triggerShape = createTrigger({
|
|
271
419
|
spaceId: space.id,
|
|
272
|
-
triggerKind:
|
|
420
|
+
triggerKind: "webhook",
|
|
273
421
|
...position({
|
|
274
422
|
x: -18,
|
|
275
423
|
y: -2
|
|
@@ -320,8 +468,8 @@ var generator2 = () => ({
|
|
|
320
468
|
"objectChange-queue",
|
|
321
469
|
async (space, n, cb) => {
|
|
322
470
|
const objects = range2(n, () => {
|
|
323
|
-
const { canvasModel, computeModel } = createQueueSinkPreset(space,
|
|
324
|
-
|
|
471
|
+
const { canvasModel, computeModel } = createQueueSinkPreset(space, "subscription", (triggerSpec) => triggerSpec.query = {
|
|
472
|
+
ast: Query.select(Filter2.typename("dxos.org/type/Chess")).ast
|
|
325
473
|
}, "type");
|
|
326
474
|
return addToSpace("objectChange-queue", space, canvasModel, computeModel);
|
|
327
475
|
});
|
|
@@ -333,7 +481,7 @@ var generator2 = () => ({
|
|
|
333
481
|
"timerTick-queue",
|
|
334
482
|
async (space, n, cb) => {
|
|
335
483
|
const objects = range2(n, () => {
|
|
336
|
-
const { canvasModel, computeModel } = createQueueSinkPreset(space,
|
|
484
|
+
const { canvasModel, computeModel } = createQueueSinkPreset(space, "timer", (triggerSpec) => triggerSpec.cron = "*/5 * * * * *", "result");
|
|
337
485
|
return addToSpace("timerTick-queue", space, canvasModel, computeModel);
|
|
338
486
|
});
|
|
339
487
|
cb?.(objects);
|
|
@@ -360,7 +508,7 @@ var generator2 = () => ({
|
|
|
360
508
|
// canvasModel.builder.call((builder) => {
|
|
361
509
|
// const triggerShape = createTrigger({
|
|
362
510
|
// spaceId: space.id,
|
|
363
|
-
// triggerKind:
|
|
511
|
+
// triggerKind: 'email',
|
|
364
512
|
// ...position({ x: -18, y: -2 }),
|
|
365
513
|
// });
|
|
366
514
|
// const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -475,7 +623,7 @@ var generator2 = () => ({
|
|
|
475
623
|
// );
|
|
476
624
|
// const triggerShape = createTrigger({
|
|
477
625
|
// spaceId: space.id,
|
|
478
|
-
// triggerKind:
|
|
626
|
+
// triggerKind: 'email',
|
|
479
627
|
// ...rawPosition({ centerX: -736, centerY: -384, width: 182, height: 192 }),
|
|
480
628
|
// });
|
|
481
629
|
// const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -584,7 +732,7 @@ var generator2 = () => ({
|
|
|
584
732
|
canvasModel.builder.call((builder) => {
|
|
585
733
|
const triggerShape = createTrigger({
|
|
586
734
|
spaceId: space.id,
|
|
587
|
-
triggerKind:
|
|
735
|
+
triggerKind: "timer",
|
|
588
736
|
...position({
|
|
589
737
|
x: -10,
|
|
590
738
|
y: -5
|
|
@@ -720,7 +868,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
720
868
|
const triggerSpec = functionTrigger.spec;
|
|
721
869
|
invariant(triggerSpec && triggerSpec.kind === triggerKind, "No trigger spec.", {
|
|
722
870
|
F: __dxlog_file,
|
|
723
|
-
L:
|
|
871
|
+
L: 660,
|
|
724
872
|
S: void 0,
|
|
725
873
|
A: [
|
|
726
874
|
"triggerSpec && triggerSpec.kind === triggerKind",
|
|
@@ -733,7 +881,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
733
881
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
734
882
|
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
735
883
|
F: __dxlog_file,
|
|
736
|
-
L:
|
|
884
|
+
L: 667,
|
|
737
885
|
S: void 0,
|
|
738
886
|
A: [
|
|
739
887
|
"templateComputeNode",
|
|
@@ -757,9 +905,9 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
757
905
|
};
|
|
758
906
|
};
|
|
759
907
|
var addToSpace = (name, space, canvas, compute) => {
|
|
760
|
-
return space.db.add(
|
|
908
|
+
return space.db.add(Obj.make(CanvasBoardType, {
|
|
761
909
|
name,
|
|
762
|
-
computeGraph:
|
|
910
|
+
computeGraph: Ref.make(compute.root),
|
|
763
911
|
layout: canvas.graph
|
|
764
912
|
}));
|
|
765
913
|
};
|
|
@@ -795,14 +943,14 @@ var setupQueue = (space, canvasModel, args) => {
|
|
|
795
943
|
var attachTrigger = (functionTrigger, computeModel) => {
|
|
796
944
|
invariant(functionTrigger, void 0, {
|
|
797
945
|
F: __dxlog_file,
|
|
798
|
-
L:
|
|
946
|
+
L: 706,
|
|
799
947
|
S: void 0,
|
|
800
948
|
A: [
|
|
801
949
|
"functionTrigger",
|
|
802
950
|
""
|
|
803
951
|
]
|
|
804
952
|
});
|
|
805
|
-
functionTrigger.function =
|
|
953
|
+
functionTrigger.function = Ref.make(computeModel.root);
|
|
806
954
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT2);
|
|
807
955
|
functionTrigger.inputNodeId = inputNode.id;
|
|
808
956
|
};
|
|
@@ -850,6 +998,36 @@ var position = (rect) => {
|
|
|
850
998
|
}
|
|
851
999
|
};
|
|
852
1000
|
|
|
1001
|
+
// src/components/SpaceGenerator/SchemaTable.tsx
|
|
1002
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
1003
|
+
import React from "react";
|
|
1004
|
+
import { IconButton } from "@dxos/react-ui";
|
|
1005
|
+
var SchemaTable = ({ types, objects = {}, label, onClick }) => {
|
|
1006
|
+
var _effect = _useSignals();
|
|
1007
|
+
try {
|
|
1008
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1009
|
+
className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
|
|
1010
|
+
}, /* @__PURE__ */ React.createElement("h2", {
|
|
1011
|
+
className: "p-2"
|
|
1012
|
+
}, label), types.map((type) => /* @__PURE__ */ React.createElement("div", {
|
|
1013
|
+
key: type.typename,
|
|
1014
|
+
className: "grid grid-cols-subgrid col-span-3 items-center"
|
|
1015
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1016
|
+
className: "pli-2 text-sm font-mono text-subdued"
|
|
1017
|
+
}, type.typename), /* @__PURE__ */ React.createElement("div", {
|
|
1018
|
+
className: "pli-2 text-right font-mono"
|
|
1019
|
+
}, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
|
|
1020
|
+
variant: "ghost",
|
|
1021
|
+
icon: "ph--plus--regular",
|
|
1022
|
+
iconOnly: true,
|
|
1023
|
+
label: "Create data",
|
|
1024
|
+
onClick: () => onClick(type.typename)
|
|
1025
|
+
}))));
|
|
1026
|
+
} finally {
|
|
1027
|
+
_effect.f();
|
|
1028
|
+
}
|
|
1029
|
+
};
|
|
1030
|
+
|
|
853
1031
|
// src/components/SpaceGenerator/SpaceGenerator.tsx
|
|
854
1032
|
var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
855
1033
|
var _effect = _useSignals2();
|
|
@@ -857,16 +1035,15 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
857
1035
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
858
1036
|
const client = useClient();
|
|
859
1037
|
const staticTypes = [
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
1038
|
+
Markdown3.Document,
|
|
1039
|
+
Diagram2.Diagram,
|
|
1040
|
+
Sheet2.Sheet,
|
|
863
1041
|
ComputeGraph2
|
|
864
1042
|
];
|
|
865
1043
|
const recordTypes = [
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
DataType2.Message
|
|
1044
|
+
Organization2.Organization,
|
|
1045
|
+
Person2.Person,
|
|
1046
|
+
Task.Task
|
|
870
1047
|
];
|
|
871
1048
|
const [count, setCount] = useState(1);
|
|
872
1049
|
const [info, setInfo] = useState({});
|
|
@@ -893,7 +1070,7 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
893
1070
|
const updateInfo = async () => {
|
|
894
1071
|
const echoSchema = await space.db.schemaRegistry.query().run();
|
|
895
1072
|
const staticSchema = space.db.graph.schemaRegistry.schemas;
|
|
896
|
-
const { objects } = await space.db.query(
|
|
1073
|
+
const { objects } = await space.db.query(Filter3.everything()).run();
|
|
897
1074
|
const objectMap = sortKeys(objects.reduce((map, obj) => {
|
|
898
1075
|
const type = getTypename(obj);
|
|
899
1076
|
if (type) {
|
|
@@ -962,8 +1139,8 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
962
1139
|
label: "Presets",
|
|
963
1140
|
onClick: handleCreateData
|
|
964
1141
|
}), /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
|
|
965
|
-
|
|
966
|
-
|
|
1142
|
+
language: "json",
|
|
1143
|
+
classNames: "text-xs"
|
|
967
1144
|
}, JSON.stringify({
|
|
968
1145
|
space,
|
|
969
1146
|
...info
|
|
@@ -980,4 +1157,4 @@ var SpaceGenerator_default = SpaceGenerator;
|
|
|
980
1157
|
export {
|
|
981
1158
|
SpaceGenerator_default as default
|
|
982
1159
|
};
|
|
983
|
-
//# sourceMappingURL=SpaceGenerator-
|
|
1160
|
+
//# sourceMappingURL=SpaceGenerator-IFOX6XDJ.mjs.map
|