@dxos/plugin-debug 0.8.4-main.c1de068 → 0.8.4-main.c4373fc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +20 -0
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +7 -0
- package/dist/lib/browser/{SpaceGenerator-AG3XGNMV.mjs → SpaceGenerator-54FUIZIH.mjs} +243 -67
- package/dist/lib/browser/SpaceGenerator-54FUIZIH.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-SQXFD2BL.mjs → app-graph-builder-I4IHBKKN.mjs} +75 -84
- package/dist/lib/browser/app-graph-builder-I4IHBKKN.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-5XPIRNQS.mjs → chunk-SVCKCXCL.mjs} +2 -4
- package/dist/lib/browser/chunk-SVCKCXCL.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +14 -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-QLZE7VSQ.mjs} +6 -6
- package/dist/lib/browser/react-context-QLZE7VSQ.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-3GD2OWCA.mjs → react-surface-BTWJ2I3F.mjs} +78 -74
- package/dist/lib/browser/react-surface-BTWJ2I3F.mjs.map +7 -0
- package/dist/lib/browser/{settings-LSSWLM5I.mjs → settings-EBVICEEW.mjs} +5 -5
- package/dist/lib/browser/{settings-LSSWLM5I.mjs.map → settings-EBVICEEW.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 +1 -1
- 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 +4 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +66 -63
- package/src/DebugPlugin.tsx +6 -7
- package/src/capabilities/app-graph-builder.ts +63 -89
- package/src/capabilities/react-context.tsx +2 -2
- package/src/capabilities/react-surface.tsx +49 -47
- package/src/components/DebugGraph.tsx +14 -0
- package/src/components/DebugObjectPanel.tsx +2 -4
- package/src/components/DebugSettings.tsx +74 -66
- package/src/components/DebugStatus.tsx +2 -2
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +13 -13
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +11 -11
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +7 -7
- package/src/components/SpaceGenerator/draw-util.ts +5 -5
- package/src/components/SpaceGenerator/presets.ts +179 -12
- package/src/components/Wireframe.tsx +2 -1
- package/src/components/index.ts +1 -1
- package/src/meta.ts +1 -3
- 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.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
|
+
}
|
|
@@ -3,15 +3,15 @@ import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking"
|
|
|
3
3
|
import React2, { useCallback, useMemo, useState } from "react";
|
|
4
4
|
import { useIntentDispatcher } from "@dxos/app-framework";
|
|
5
5
|
import { ComputeGraph as ComputeGraph2 } from "@dxos/conductor";
|
|
6
|
-
import { Filter as
|
|
7
|
-
import {
|
|
6
|
+
import { Filter as Filter3 } from "@dxos/echo";
|
|
7
|
+
import { Markdown as Markdown3 } from "@dxos/plugin-markdown/types";
|
|
8
8
|
import { SheetType as SheetType2 } from "@dxos/plugin-sheet/types";
|
|
9
9
|
import { DiagramType as DiagramType2 } from "@dxos/plugin-sketch/types";
|
|
10
10
|
import { useClient } from "@dxos/react-client";
|
|
11
11
|
import { getTypename } from "@dxos/react-client/echo";
|
|
12
12
|
import { IconButton as IconButton2, Input, Toolbar, useAsyncEffect } from "@dxos/react-ui";
|
|
13
13
|
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
14
|
-
import { DataType as
|
|
14
|
+
import { DataType as DataType3 } from "@dxos/schema";
|
|
15
15
|
import { jsonKeyReplacer, sortKeys } from "@dxos/util";
|
|
16
16
|
|
|
17
17
|
// src/components/SpaceGenerator/ObjectGenerator.tsx
|
|
@@ -19,21 +19,21 @@ 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
21
|
import { DXN, Filter, Key, Obj, Ref, Type } from "@dxos/echo";
|
|
22
|
-
import {
|
|
22
|
+
import { Markdown } from "@dxos/plugin-markdown/types";
|
|
23
23
|
import { createSheet } from "@dxos/plugin-sheet/types";
|
|
24
24
|
import { SheetType } from "@dxos/plugin-sheet/types";
|
|
25
25
|
import { CanvasType, DiagramType } from "@dxos/plugin-sketch/types";
|
|
26
26
|
import { SpaceAction } from "@dxos/plugin-space/types";
|
|
27
27
|
import { faker } from "@dxos/random";
|
|
28
|
-
import { DataType } from "@dxos/schema";
|
|
28
|
+
import { DataType, getTypenameFromQuery } from "@dxos/schema";
|
|
29
29
|
import { createAsyncGenerator } from "@dxos/schema/testing";
|
|
30
30
|
import { range } from "@dxos/util";
|
|
31
31
|
var generator = faker;
|
|
32
32
|
var findViewByTypename = async (views, typename) => {
|
|
33
|
-
return views.find((view) => view.query.
|
|
33
|
+
return views.find((view) => getTypenameFromQuery(view.query.ast) === typename);
|
|
34
34
|
};
|
|
35
35
|
var createGenerator = (client, dispatch, schema) => {
|
|
36
|
-
return async (space, n
|
|
36
|
+
return async (space, n) => {
|
|
37
37
|
const typename = schema.typename;
|
|
38
38
|
const { objects: views } = await space.db.query(Filter.type(DataType.View)).run();
|
|
39
39
|
const view = await findViewByTypename(views, typename);
|
|
@@ -57,14 +57,12 @@ var createGenerator = (client, dispatch, schema) => {
|
|
|
57
57
|
};
|
|
58
58
|
var staticGenerators = /* @__PURE__ */ new Map([
|
|
59
59
|
[
|
|
60
|
-
|
|
60
|
+
Markdown.Document.typename,
|
|
61
61
|
async (space, n, cb) => {
|
|
62
62
|
const objects = range(n).map(() => {
|
|
63
|
-
return space.db.add(
|
|
63
|
+
return space.db.add(Markdown.makeDocument({
|
|
64
64
|
name: faker.commerce.productName(),
|
|
65
|
-
content:
|
|
66
|
-
content: faker.lorem.sentences(5)
|
|
67
|
-
}))
|
|
65
|
+
content: faker.lorem.sentences(5)
|
|
68
66
|
}));
|
|
69
67
|
});
|
|
70
68
|
cb?.(objects);
|
|
@@ -198,47 +196,25 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
198
196
|
]
|
|
199
197
|
]);
|
|
200
198
|
|
|
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
199
|
// src/components/SpaceGenerator/presets.ts
|
|
232
|
-
import
|
|
200
|
+
import * as Schema from "effect/Schema";
|
|
201
|
+
import { RESEARCH_BLUEPRINT, ResearchOn, agent, entityExtraction } from "@dxos/assistant-testing";
|
|
202
|
+
import { Prompt } from "@dxos/blueprints";
|
|
233
203
|
import { NODE_INPUT as NODE_INPUT2 } from "@dxos/conductor";
|
|
234
|
-
import { DXN as DXN2, Key as Key2, Obj as Obj2, Ref as Ref2, Type as Type2 } from "@dxos/echo";
|
|
235
|
-
import { FunctionTrigger,
|
|
204
|
+
import { DXN as DXN2, Filter as Filter2, Key as Key2, Obj as Obj2, Query, Ref as Ref2, Relation, Type as Type2 } from "@dxos/echo";
|
|
205
|
+
import { FunctionTrigger, serializeFunction } from "@dxos/functions";
|
|
236
206
|
import { invariant } from "@dxos/invariant";
|
|
237
|
-
import {
|
|
207
|
+
import { sync } from "@dxos/plugin-inbox";
|
|
208
|
+
import { Mailbox } from "@dxos/plugin-inbox/types";
|
|
209
|
+
import { Markdown as Markdown2 } from "@dxos/plugin-markdown/types";
|
|
210
|
+
import { createAppend, createChat, createComputeGraph, createConstant, createFunction, createGpt, createQueue, createRandom, createSurface, createTemplate, createText, createTrigger } from "@dxos/react-ui-canvas-compute";
|
|
238
211
|
import { CanvasBoardType, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from "@dxos/react-ui-canvas-editor";
|
|
212
|
+
import { DataType as DataType2, createView } from "@dxos/schema";
|
|
239
213
|
import { range as range2 } 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";
|
|
@@ -246,7 +222,7 @@ var PresetName = /* @__PURE__ */ function(PresetName2) {
|
|
|
246
222
|
PresetName2["TIMER_TICK_QUEUE"] = "timerTick-queue";
|
|
247
223
|
PresetName2["DISCORD_MESSAGES"] = "discord-messages";
|
|
248
224
|
return PresetName2;
|
|
249
|
-
}({});
|
|
225
|
+
})({});
|
|
250
226
|
var generator2 = () => ({
|
|
251
227
|
schemas: [
|
|
252
228
|
CanvasBoardType,
|
|
@@ -256,6 +232,176 @@ var generator2 = () => ({
|
|
|
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(Obj2.make(DataType2.Organization, {
|
|
240
|
+
name: "DXOS",
|
|
241
|
+
website: "https://dxos.org"
|
|
242
|
+
}));
|
|
243
|
+
const doc = space.db.add(Markdown2.makeDocument({
|
|
244
|
+
name: "DXOS Research",
|
|
245
|
+
content: "DXOS builds Composer, an open-source AI-powered malleable application."
|
|
246
|
+
}));
|
|
247
|
+
space.db.add(Relation.make(ResearchOn, {
|
|
248
|
+
[Relation.Source]: doc,
|
|
249
|
+
[Relation.Target]: org,
|
|
250
|
+
completedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
251
|
+
}));
|
|
252
|
+
space.db.add(Obj2.make(DataType2.Person, {
|
|
253
|
+
fullName: "Rich",
|
|
254
|
+
jobTitle: "investor",
|
|
255
|
+
organization: Ref2.make(org)
|
|
256
|
+
}));
|
|
257
|
+
space.db.add(Obj2.make(DataType2.Person, {
|
|
258
|
+
fullName: "Josiah",
|
|
259
|
+
organization: Ref2.make(org)
|
|
260
|
+
}));
|
|
261
|
+
space.db.add(Obj2.make(DataType2.Person, {
|
|
262
|
+
fullName: "Dima",
|
|
263
|
+
organization: Ref2.make(org)
|
|
264
|
+
}));
|
|
265
|
+
space.db.add(Obj2.make(DataType2.Person, {
|
|
266
|
+
fullName: "Mykola",
|
|
267
|
+
organization: Ref2.make(org)
|
|
268
|
+
}));
|
|
269
|
+
space.db.add(Obj2.make(DataType2.Person, {
|
|
270
|
+
fullName: "Will",
|
|
271
|
+
organization: Ref2.make(org)
|
|
272
|
+
}));
|
|
273
|
+
return doc;
|
|
274
|
+
});
|
|
275
|
+
cb?.(objects);
|
|
276
|
+
return objects;
|
|
277
|
+
}
|
|
278
|
+
],
|
|
279
|
+
[
|
|
280
|
+
"org-research-project",
|
|
281
|
+
async (space, n, cb) => {
|
|
282
|
+
const mailbox = await space.db.query(Filter2.type(Mailbox.Mailbox)).first();
|
|
283
|
+
const objects = range2(n, () => {
|
|
284
|
+
const contactsQuery = Query.select(Filter2.type(DataType2.Person, {
|
|
285
|
+
jobTitle: "investor"
|
|
286
|
+
}));
|
|
287
|
+
const organizationsQuery = contactsQuery.reference("organization");
|
|
288
|
+
const notesQuery = organizationsQuery.targetOf(ResearchOn).source();
|
|
289
|
+
const contactsQueryString = 'Query.select(Filter.type(DataType.Person, { jobTitle: "investor" }))';
|
|
290
|
+
const organizationsQueryString = `${contactsQueryString}.reference("organization")`;
|
|
291
|
+
const notesQueryString = `${organizationsQueryString}.targetOf(ResearchOn).source()`;
|
|
292
|
+
const emailSyncTrigger = Obj2.make(FunctionTrigger, {
|
|
293
|
+
enabled: true,
|
|
294
|
+
spec: {
|
|
295
|
+
kind: "timer",
|
|
296
|
+
cron: "* * * * *"
|
|
297
|
+
},
|
|
298
|
+
function: Ref2.make(serializeFunction(sync)),
|
|
299
|
+
input: {
|
|
300
|
+
mailboxId: Obj2.getDXN(mailbox).toString()
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
space.db.add(emailSyncTrigger);
|
|
304
|
+
const contactExtractionTrigger = Obj2.make(FunctionTrigger, {
|
|
305
|
+
enabled: true,
|
|
306
|
+
// TODO(wittjosiah): Queue trigger doesn't support matching query of the column.
|
|
307
|
+
spec: {
|
|
308
|
+
kind: "queue",
|
|
309
|
+
queue: mailbox.queue.dxn.toString()
|
|
310
|
+
},
|
|
311
|
+
function: Ref2.make(serializeFunction(entityExtraction)),
|
|
312
|
+
input: {
|
|
313
|
+
source: "{{event.item}}"
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
space.db.add(contactExtractionTrigger);
|
|
317
|
+
const researchPrompt = space.db.add(Prompt.make({
|
|
318
|
+
name: "Research",
|
|
319
|
+
description: "Research organization",
|
|
320
|
+
input: Schema.Struct({
|
|
321
|
+
org: Schema.Any
|
|
322
|
+
}),
|
|
323
|
+
output: Schema.Any,
|
|
324
|
+
// TODO(dmaretskyi): This mocks research (returns pre-baked result), the actual research might take compute minutes.
|
|
325
|
+
// Remove the mock prompt to do the actual research.
|
|
326
|
+
instructions: "Research the organization provided as input. Create a research note for it at the end. NOTE: Do mocked reseach (set mockSearch to true).",
|
|
327
|
+
blueprints: [
|
|
328
|
+
Ref2.make(RESEARCH_BLUEPRINT)
|
|
329
|
+
]
|
|
330
|
+
}));
|
|
331
|
+
const researchTrigger = Obj2.make(FunctionTrigger, {
|
|
332
|
+
enabled: true,
|
|
333
|
+
spec: {
|
|
334
|
+
kind: "subscription",
|
|
335
|
+
query: {
|
|
336
|
+
string: organizationsQueryString,
|
|
337
|
+
ast: organizationsQuery.ast
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
function: Ref2.make(serializeFunction(agent)),
|
|
341
|
+
input: {
|
|
342
|
+
prompt: Ref2.make(researchPrompt),
|
|
343
|
+
input: "{{event.subject}}"
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
space.db.add(researchTrigger);
|
|
347
|
+
const mailboxView = createView({
|
|
348
|
+
name: "Mailbox",
|
|
349
|
+
query: Query.select(Filter2.type(DataType2.Message, {
|
|
350
|
+
properties: {
|
|
351
|
+
labels: Filter2.contains("investor")
|
|
352
|
+
}
|
|
353
|
+
})).options({
|
|
354
|
+
queues: [
|
|
355
|
+
mailbox.queue.dxn.toString()
|
|
356
|
+
]
|
|
357
|
+
}),
|
|
358
|
+
queryString: 'Query.select(Filter.type(DataType.Message, { properties: { labels: Filter.contains("investor") } }))',
|
|
359
|
+
jsonSchema: Type2.toJsonSchema(DataType2.Message),
|
|
360
|
+
presentation: Obj2.make(DataType2.Collection, {
|
|
361
|
+
objects: []
|
|
362
|
+
})
|
|
363
|
+
});
|
|
364
|
+
const contactsView = createView({
|
|
365
|
+
name: "Contacts",
|
|
366
|
+
query: contactsQuery,
|
|
367
|
+
queryString: contactsQueryString,
|
|
368
|
+
jsonSchema: Type2.toJsonSchema(DataType2.Person),
|
|
369
|
+
presentation: Obj2.make(DataType2.Collection, {
|
|
370
|
+
objects: []
|
|
371
|
+
})
|
|
372
|
+
});
|
|
373
|
+
const organizationsView = createView({
|
|
374
|
+
name: "Organizations",
|
|
375
|
+
query: organizationsQuery,
|
|
376
|
+
queryString: organizationsQueryString,
|
|
377
|
+
jsonSchema: Type2.toJsonSchema(DataType2.Organization),
|
|
378
|
+
presentation: Obj2.make(DataType2.Collection, {
|
|
379
|
+
objects: []
|
|
380
|
+
})
|
|
381
|
+
});
|
|
382
|
+
const notesView = createView({
|
|
383
|
+
name: "Notes",
|
|
384
|
+
query: notesQuery,
|
|
385
|
+
queryString: notesQueryString,
|
|
386
|
+
jsonSchema: Type2.toJsonSchema(Markdown2.Document),
|
|
387
|
+
presentation: Obj2.make(DataType2.Collection, {
|
|
388
|
+
objects: []
|
|
389
|
+
})
|
|
390
|
+
});
|
|
391
|
+
return space.db.add(DataType2.makeProject({
|
|
392
|
+
name: "Investor Research",
|
|
393
|
+
collections: [
|
|
394
|
+
mailboxView,
|
|
395
|
+
contactsView,
|
|
396
|
+
organizationsView,
|
|
397
|
+
notesView
|
|
398
|
+
].map((view) => Ref2.make(view))
|
|
399
|
+
}));
|
|
400
|
+
});
|
|
401
|
+
cb?.(objects.flat());
|
|
402
|
+
return objects.flat();
|
|
403
|
+
}
|
|
404
|
+
],
|
|
259
405
|
[
|
|
260
406
|
"webhook-gpt-queue",
|
|
261
407
|
async (space, n, cb) => {
|
|
@@ -269,7 +415,7 @@ var generator2 = () => ({
|
|
|
269
415
|
})));
|
|
270
416
|
const triggerShape = createTrigger({
|
|
271
417
|
spaceId: space.id,
|
|
272
|
-
triggerKind:
|
|
418
|
+
triggerKind: "webhook",
|
|
273
419
|
...position({
|
|
274
420
|
x: -18,
|
|
275
421
|
y: -2
|
|
@@ -320,8 +466,9 @@ var generator2 = () => ({
|
|
|
320
466
|
"objectChange-queue",
|
|
321
467
|
async (space, n, cb) => {
|
|
322
468
|
const objects = range2(n, () => {
|
|
323
|
-
const { canvasModel, computeModel } = createQueueSinkPreset(space,
|
|
324
|
-
|
|
469
|
+
const { canvasModel, computeModel } = createQueueSinkPreset(space, "subscription", (triggerSpec) => triggerSpec.query = {
|
|
470
|
+
string: 'Query.select(Filter.typename("dxos.org/type/Chess"))',
|
|
471
|
+
ast: Query.select(Filter2.typename("dxos.org/type/Chess")).ast
|
|
325
472
|
}, "type");
|
|
326
473
|
return addToSpace("objectChange-queue", space, canvasModel, computeModel);
|
|
327
474
|
});
|
|
@@ -333,7 +480,7 @@ var generator2 = () => ({
|
|
|
333
480
|
"timerTick-queue",
|
|
334
481
|
async (space, n, cb) => {
|
|
335
482
|
const objects = range2(n, () => {
|
|
336
|
-
const { canvasModel, computeModel } = createQueueSinkPreset(space,
|
|
483
|
+
const { canvasModel, computeModel } = createQueueSinkPreset(space, "timer", (triggerSpec) => triggerSpec.cron = "*/5 * * * * *", "result");
|
|
337
484
|
return addToSpace("timerTick-queue", space, canvasModel, computeModel);
|
|
338
485
|
});
|
|
339
486
|
cb?.(objects);
|
|
@@ -360,7 +507,7 @@ var generator2 = () => ({
|
|
|
360
507
|
// canvasModel.builder.call((builder) => {
|
|
361
508
|
// const triggerShape = createTrigger({
|
|
362
509
|
// spaceId: space.id,
|
|
363
|
-
// triggerKind:
|
|
510
|
+
// triggerKind: 'email',
|
|
364
511
|
// ...position({ x: -18, y: -2 }),
|
|
365
512
|
// });
|
|
366
513
|
// const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -475,7 +622,7 @@ var generator2 = () => ({
|
|
|
475
622
|
// );
|
|
476
623
|
// const triggerShape = createTrigger({
|
|
477
624
|
// spaceId: space.id,
|
|
478
|
-
// triggerKind:
|
|
625
|
+
// triggerKind: 'email',
|
|
479
626
|
// ...rawPosition({ centerX: -736, centerY: -384, width: 182, height: 192 }),
|
|
480
627
|
// });
|
|
481
628
|
// const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -584,7 +731,7 @@ var generator2 = () => ({
|
|
|
584
731
|
canvasModel.builder.call((builder) => {
|
|
585
732
|
const triggerShape = createTrigger({
|
|
586
733
|
spaceId: space.id,
|
|
587
|
-
triggerKind:
|
|
734
|
+
triggerKind: "timer",
|
|
588
735
|
...position({
|
|
589
736
|
x: -10,
|
|
590
737
|
y: -5
|
|
@@ -720,7 +867,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
720
867
|
const triggerSpec = functionTrigger.spec;
|
|
721
868
|
invariant(triggerSpec && triggerSpec.kind === triggerKind, "No trigger spec.", {
|
|
722
869
|
F: __dxlog_file,
|
|
723
|
-
L:
|
|
870
|
+
L: 663,
|
|
724
871
|
S: void 0,
|
|
725
872
|
A: [
|
|
726
873
|
"triggerSpec && triggerSpec.kind === triggerKind",
|
|
@@ -733,7 +880,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
733
880
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
734
881
|
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
735
882
|
F: __dxlog_file,
|
|
736
|
-
L:
|
|
883
|
+
L: 670,
|
|
737
884
|
S: void 0,
|
|
738
885
|
A: [
|
|
739
886
|
"templateComputeNode",
|
|
@@ -795,7 +942,7 @@ var setupQueue = (space, canvasModel, args) => {
|
|
|
795
942
|
var attachTrigger = (functionTrigger, computeModel) => {
|
|
796
943
|
invariant(functionTrigger, void 0, {
|
|
797
944
|
F: __dxlog_file,
|
|
798
|
-
L:
|
|
945
|
+
L: 709,
|
|
799
946
|
S: void 0,
|
|
800
947
|
A: [
|
|
801
948
|
"functionTrigger",
|
|
@@ -850,6 +997,36 @@ var position = (rect) => {
|
|
|
850
997
|
}
|
|
851
998
|
};
|
|
852
999
|
|
|
1000
|
+
// src/components/SpaceGenerator/SchemaTable.tsx
|
|
1001
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
1002
|
+
import React from "react";
|
|
1003
|
+
import { IconButton } from "@dxos/react-ui";
|
|
1004
|
+
var SchemaTable = ({ types, objects = {}, label, onClick }) => {
|
|
1005
|
+
var _effect = _useSignals();
|
|
1006
|
+
try {
|
|
1007
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1008
|
+
className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
|
|
1009
|
+
}, /* @__PURE__ */ React.createElement("h2", {
|
|
1010
|
+
className: "p-2"
|
|
1011
|
+
}, label), types.map((type) => /* @__PURE__ */ React.createElement("div", {
|
|
1012
|
+
key: type.typename,
|
|
1013
|
+
className: "grid grid-cols-subgrid col-span-3 items-center"
|
|
1014
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1015
|
+
className: "px-2 text-sm font-mono text-subdued"
|
|
1016
|
+
}, type.typename), /* @__PURE__ */ React.createElement("div", {
|
|
1017
|
+
className: "px-2 text-right font-mono"
|
|
1018
|
+
}, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
|
|
1019
|
+
variant: "ghost",
|
|
1020
|
+
icon: "ph--plus--regular",
|
|
1021
|
+
iconOnly: true,
|
|
1022
|
+
label: "Create data",
|
|
1023
|
+
onClick: () => onClick(type.typename)
|
|
1024
|
+
}))));
|
|
1025
|
+
} finally {
|
|
1026
|
+
_effect.f();
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
|
|
853
1030
|
// src/components/SpaceGenerator/SpaceGenerator.tsx
|
|
854
1031
|
var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
855
1032
|
var _effect = _useSignals2();
|
|
@@ -857,16 +1034,15 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
857
1034
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
858
1035
|
const client = useClient();
|
|
859
1036
|
const staticTypes = [
|
|
860
|
-
|
|
1037
|
+
Markdown3.Document,
|
|
861
1038
|
DiagramType2,
|
|
862
1039
|
SheetType2,
|
|
863
1040
|
ComputeGraph2
|
|
864
1041
|
];
|
|
865
1042
|
const recordTypes = [
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
DataType2.Message
|
|
1043
|
+
DataType3.Organization,
|
|
1044
|
+
DataType3.Person,
|
|
1045
|
+
DataType3.Task
|
|
870
1046
|
];
|
|
871
1047
|
const [count, setCount] = useState(1);
|
|
872
1048
|
const [info, setInfo] = useState({});
|
|
@@ -893,7 +1069,7 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
893
1069
|
const updateInfo = async () => {
|
|
894
1070
|
const echoSchema = await space.db.schemaRegistry.query().run();
|
|
895
1071
|
const staticSchema = space.db.graph.schemaRegistry.schemas;
|
|
896
|
-
const { objects } = await space.db.query(
|
|
1072
|
+
const { objects } = await space.db.query(Filter3.everything()).run();
|
|
897
1073
|
const objectMap = sortKeys(objects.reduce((map, obj) => {
|
|
898
1074
|
const type = getTypename(obj);
|
|
899
1075
|
if (type) {
|
|
@@ -962,8 +1138,8 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
962
1138
|
label: "Presets",
|
|
963
1139
|
onClick: handleCreateData
|
|
964
1140
|
}), /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
|
|
965
|
-
|
|
966
|
-
|
|
1141
|
+
language: "json",
|
|
1142
|
+
classNames: "text-xs"
|
|
967
1143
|
}, JSON.stringify({
|
|
968
1144
|
space,
|
|
969
1145
|
...info
|
|
@@ -980,4 +1156,4 @@ var SpaceGenerator_default = SpaceGenerator;
|
|
|
980
1156
|
export {
|
|
981
1157
|
SpaceGenerator_default as default
|
|
982
1158
|
};
|
|
983
|
-
//# sourceMappingURL=SpaceGenerator-
|
|
1159
|
+
//# sourceMappingURL=SpaceGenerator-54FUIZIH.mjs.map
|