@dxos/plugin-debug 0.8.4-main.3c1ae3b → 0.8.4-main.52d7546f51
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-6VMEOKEV.mjs +15 -0
- package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs.map +7 -0
- package/dist/lib/browser/DevtoolsOverviewContainer-2C6XMJ3L.mjs +19 -0
- package/dist/lib/browser/DevtoolsOverviewContainer-2C6XMJ3L.mjs.map +7 -0
- package/dist/lib/browser/{SpaceGenerator-GYCIEMMO.mjs → SpaceGenerator-W3LJORYT.mjs} +167 -173
- package/dist/lib/browser/SpaceGenerator-W3LJORYT.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-DEBTVBQG.mjs +599 -0
- package/dist/lib/browser/app-graph-builder-DEBTVBQG.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SRV2AIGJ.mjs → chunk-4UFQXPP7.mjs} +11 -1
- package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WZFZ4ESO.mjs → chunk-A5H5GRV6.mjs} +1 -1
- package/dist/lib/browser/chunk-A5H5GRV6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +34 -38
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-I3USIAF6.mjs +17 -0
- package/dist/lib/browser/react-context-I3USIAF6.mjs.map +7 -0
- package/dist/lib/browser/react-surface-FMVC5GPV.mjs +758 -0
- package/dist/lib/browser/react-surface-FMVC5GPV.mjs.map +7 -0
- package/dist/lib/browser/settings-SLTQJJNF.mjs +32 -0
- package/dist/lib/browser/settings-SLTQJJNF.mjs.map +7 -0
- package/dist/types/src/DebugPlugin.d.ts +2 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -8
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context/index.d.ts +7 -0
- package/dist/types/src/capabilities/react-context/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-context/react-context.d.ts +10 -0
- package/dist/types/src/capabilities/react-context/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +3 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +6 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/components/DebugGraph.d.ts +5 -4
- package/dist/types/src/components/DebugGraph.d.ts.map +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts +4 -2
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +1 -48
- 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 +4 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +5 -0
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +77 -71
- package/src/DebugPlugin.tsx +17 -31
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +421 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/index.ts +4 -6
- package/src/capabilities/react-context/index.ts +7 -0
- package/src/capabilities/react-context/react-context.tsx +20 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +411 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +31 -0
- package/src/components/DebugGraph.tsx +4 -3
- package/src/components/DebugObjectPanel.tsx +4 -5
- package/src/components/DebugSettings.tsx +26 -21
- package/src/components/DevtoolsOverviewContainer.tsx +2 -2
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +5 -5
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +8 -6
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +21 -21
- package/src/components/SpaceGenerator/presets.ts +139 -42
- package/src/components/Wireframe.tsx +2 -2
- package/src/components/index.ts +4 -1
- package/src/meta.ts +2 -2
- package/src/types.ts +8 -0
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +0 -20
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +0 -7
- package/dist/lib/browser/DevtoolsOverviewContainer-JXVZVPHN.mjs +0 -25
- package/dist/lib/browser/DevtoolsOverviewContainer-JXVZVPHN.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-GYCIEMMO.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs +0 -588
- package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs.map +0 -7
- package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +0 -7
- package/dist/lib/browser/react-context-P2YDWEWI.mjs +0 -16
- package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +0 -7
- package/dist/lib/browser/react-surface-RFG63TTF.mjs +0 -774
- package/dist/lib/browser/react-surface-RFG63TTF.mjs.map +0 -7
- package/dist/lib/browser/settings-SQXR3OAH.mjs +0 -22
- package/dist/lib/browser/settings-SQXR3OAH.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-context.d.ts +0 -8
- package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -431
- package/src/capabilities/react-context.tsx +0 -16
- package/src/capabilities/react-surface.tsx +0 -418
- package/src/capabilities/settings.ts +0 -19
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { Surface } from '@dxos/app-framework/
|
|
7
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
8
8
|
import { StatsPanel, useStats } from '@dxos/devtools';
|
|
9
9
|
|
|
10
10
|
export const DevtoolsOverviewContainer = () => {
|
|
@@ -12,7 +12,7 @@ export const DevtoolsOverviewContainer = () => {
|
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
14
|
<StatsPanel stats={stats} onRefresh={refreshStats}>
|
|
15
|
-
<Surface role='devtools-overview' />
|
|
15
|
+
<Surface.Surface role='devtools-overview' />
|
|
16
16
|
</StatsPanel>
|
|
17
17
|
);
|
|
18
18
|
};
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import type * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { type PromiseIntentDispatcher, createIntent } from '@dxos/app-framework';
|
|
8
7
|
import { addressToA1Notation } from '@dxos/compute';
|
|
9
8
|
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from '@dxos/conductor';
|
|
10
9
|
import { DXN, Filter, Key, type Type } from '@dxos/echo';
|
|
10
|
+
import { type OperationInvoker } from '@dxos/operation';
|
|
11
11
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
12
12
|
import { Sheet } from '@dxos/plugin-sheet/types';
|
|
13
13
|
import { Diagram } from '@dxos/plugin-sketch/types';
|
|
14
|
-
import {
|
|
14
|
+
import { SpaceOperation } from '@dxos/plugin-space/types';
|
|
15
15
|
import { faker } from '@dxos/random';
|
|
16
16
|
import { type Client } from '@dxos/react-client';
|
|
17
17
|
import { type Space } from '@dxos/react-client/echo';
|
|
@@ -29,7 +29,7 @@ export type ObjectGenerator<T> = (space: Space, n: number, cb?: (objects: T[]) =
|
|
|
29
29
|
|
|
30
30
|
export const createGenerator = <S extends Type.Obj.Any>(
|
|
31
31
|
client: Client,
|
|
32
|
-
|
|
32
|
+
invokePromise: OperationInvoker.OperationInvoker['invokePromise'],
|
|
33
33
|
schema: S,
|
|
34
34
|
): ObjectGenerator<Schema.Schema.Type<S>> => {
|
|
35
35
|
return async (space: Space, n: number): Promise<Schema.Schema.Type<S>[]> => {
|
|
@@ -40,9 +40,9 @@ export const createGenerator = <S extends Type.Obj.Any>(
|
|
|
40
40
|
const view = await findViewByTypename(views, typename);
|
|
41
41
|
const staticSchema = client?.graph.schemaRegistry.query({ typename }).runSync()[0];
|
|
42
42
|
if (!view && !staticSchema) {
|
|
43
|
-
await
|
|
43
|
+
await invokePromise(SpaceOperation.AddSchema, { db: space.db, schema, show: false });
|
|
44
44
|
} else if (!view && staticSchema) {
|
|
45
|
-
await
|
|
45
|
+
await invokePromise(SpaceOperation.UseStaticSchema, { db: space.db, typename, show: false });
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// Create objects.
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
6
7
|
import React from 'react';
|
|
7
8
|
|
|
8
|
-
import {
|
|
9
|
+
import { OperationPlugin } from '@dxos/app-framework';
|
|
9
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
11
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
11
12
|
import { useSpaces } from '@dxos/react-client/echo';
|
|
@@ -28,15 +29,16 @@ const meta = {
|
|
|
28
29
|
component: SpaceGenerator as any,
|
|
29
30
|
render: render(DefaultStory),
|
|
30
31
|
decorators: [
|
|
31
|
-
withTheme,
|
|
32
|
+
withTheme(),
|
|
32
33
|
withPluginManager({
|
|
33
34
|
plugins: [
|
|
34
35
|
ClientPlugin({
|
|
35
|
-
onClientInitialized:
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
onClientInitialized: ({ client }) =>
|
|
37
|
+
Effect.gen(function* () {
|
|
38
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
39
|
+
}),
|
|
38
40
|
}),
|
|
39
|
-
|
|
41
|
+
OperationPlugin(),
|
|
40
42
|
],
|
|
41
43
|
}),
|
|
42
44
|
],
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
8
|
import { ComputeGraph } from '@dxos/conductor';
|
|
9
9
|
import { Filter, Obj, type Type } from '@dxos/echo';
|
|
10
10
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
@@ -12,7 +12,7 @@ import { Sheet } from '@dxos/plugin-sheet/types';
|
|
|
12
12
|
import { Diagram } from '@dxos/plugin-sketch/types';
|
|
13
13
|
import { useClient } from '@dxos/react-client';
|
|
14
14
|
import { type Space } from '@dxos/react-client/echo';
|
|
15
|
-
import { IconButton, Input, Toolbar, useAsyncEffect } from '@dxos/react-ui';
|
|
15
|
+
import { IconButton, Input, Layout, ScrollArea, Toolbar, useAsyncEffect } from '@dxos/react-ui';
|
|
16
16
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
17
17
|
import { Organization, Person, Task } from '@dxos/types';
|
|
18
18
|
import { jsonKeyReplacer, sortKeys } from '@dxos/util';
|
|
@@ -23,11 +23,11 @@ import { SchemaTable } from './SchemaTable';
|
|
|
23
23
|
|
|
24
24
|
export type SpaceGeneratorProps = {
|
|
25
25
|
space: Space;
|
|
26
|
-
onCreateObjects?: (objects: Obj.
|
|
26
|
+
onCreateObjects?: (objects: Obj.Unknown[]) => void;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps) => {
|
|
30
|
-
const {
|
|
30
|
+
const { invokePromise } = useOperationInvoker();
|
|
31
31
|
const client = useClient();
|
|
32
32
|
const staticTypes = [Markdown.Document, Diagram.Diagram, Sheet.Sheet, ComputeGraph]; // TODO(burdon): Make extensible.
|
|
33
33
|
const recordTypes: Type.Obj.Any[] = [Organization.Organization, Person.Person, Task.Task];
|
|
@@ -43,17 +43,17 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
|
|
|
43
43
|
// Create type generators.
|
|
44
44
|
const typeMap = useMemo(() => {
|
|
45
45
|
const recordGenerators = new Map<string, ObjectGenerator<any>>(
|
|
46
|
-
recordTypes.map((type) => [type.typename, createGenerator(client,
|
|
46
|
+
recordTypes.map((type) => [type.typename, createGenerator(client, invokePromise, type)]),
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
return new Map([...staticGenerators, ...presets.items, ...recordGenerators]);
|
|
50
|
-
}, [client, recordTypes]);
|
|
50
|
+
}, [client, recordTypes, invokePromise]);
|
|
51
51
|
|
|
52
52
|
// Query space to get info.
|
|
53
53
|
const updateInfo = async () => {
|
|
54
54
|
// Create schema map.
|
|
55
55
|
const echoSchema = await space.db.schemaRegistry.query().run();
|
|
56
|
-
const staticSchema = space.db.graph.schemaRegistry.
|
|
56
|
+
const staticSchema = await space.db.graph.schemaRegistry.query().run();
|
|
57
57
|
|
|
58
58
|
// Create object map.
|
|
59
59
|
const objects = await space.db.query(Filter.everything()).run();
|
|
@@ -64,6 +64,7 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
|
|
|
64
64
|
const count = map[type] ?? 0;
|
|
65
65
|
map[type] = count + 1;
|
|
66
66
|
}
|
|
67
|
+
|
|
67
68
|
return map;
|
|
68
69
|
}, {}),
|
|
69
70
|
);
|
|
@@ -92,35 +93,34 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
|
|
|
92
93
|
);
|
|
93
94
|
|
|
94
95
|
return (
|
|
95
|
-
<
|
|
96
|
-
<Toolbar.Root
|
|
96
|
+
<Layout.Main toolbar>
|
|
97
|
+
<Toolbar.Root>
|
|
97
98
|
<IconButton icon='ph--arrow-clockwise--regular' iconOnly label='Refresh' onClick={updateInfo} />
|
|
98
99
|
<Toolbar.Separator variant='gap' />
|
|
99
100
|
<Input.Root>
|
|
100
101
|
<Input.TextInput
|
|
101
102
|
type='number'
|
|
103
|
+
placeholder='Count'
|
|
104
|
+
classNames='is-[4rem] text-right'
|
|
102
105
|
min={1}
|
|
103
106
|
max={100}
|
|
104
|
-
placeholder={'Count'}
|
|
105
|
-
classNames='!w-[4rem] !text-right'
|
|
106
107
|
size={8}
|
|
107
108
|
value={count}
|
|
108
|
-
onChange={(
|
|
109
|
+
onChange={(event) => setCount(parseInt(event.target.value))}
|
|
109
110
|
/>
|
|
110
111
|
</Input.Root>
|
|
111
112
|
</Toolbar.Root>
|
|
112
113
|
|
|
113
|
-
<
|
|
114
|
-
<
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
<div>
|
|
114
|
+
<ScrollArea.Root thin orientation='vertical'>
|
|
115
|
+
<ScrollArea.Viewport classNames='gap-4 divide-y divide-subduedSeparator'>
|
|
116
|
+
<SchemaTable types={staticTypes} objects={info.objects} label='Static Types' onClick={handleCreateData} />
|
|
117
|
+
<SchemaTable types={recordTypes} objects={info.objects} label='Record Types' onClick={handleCreateData} />
|
|
118
|
+
<SchemaTable types={presets.types} objects={info.objects} label='Presets' onClick={handleCreateData} />
|
|
119
119
|
<SyntaxHighlighter language='json' classNames='text-xs'>
|
|
120
120
|
{JSON.stringify({ space, ...info }, jsonKeyReplacer({ truncate: true }), 2)}
|
|
121
121
|
</SyntaxHighlighter>
|
|
122
|
-
</
|
|
123
|
-
</
|
|
124
|
-
</
|
|
122
|
+
</ScrollArea.Viewport>
|
|
123
|
+
</ScrollArea.Root>
|
|
124
|
+
</Layout.Main>
|
|
125
125
|
);
|
|
126
126
|
};
|
|
@@ -7,7 +7,7 @@ import * as Schema from 'effect/Schema';
|
|
|
7
7
|
import { Agent, EntityExtraction, ResearchBlueprint } from '@dxos/assistant-toolkit';
|
|
8
8
|
import { Prompt } from '@dxos/blueprints';
|
|
9
9
|
import { type ComputeGraphModel, NODE_INPUT } from '@dxos/conductor';
|
|
10
|
-
import { DXN, Filter, Key, Obj, Query, Ref, Tag, Type } from '@dxos/echo';
|
|
10
|
+
import { DXN, Filter, Key, Obj, Query, type QueryAST, Ref, Tag, Type } from '@dxos/echo';
|
|
11
11
|
import { Trigger, serializeFunction } from '@dxos/functions';
|
|
12
12
|
import { invariant } from '@dxos/invariant';
|
|
13
13
|
import { gmail } from '@dxos/plugin-inbox';
|
|
@@ -29,15 +29,9 @@ import {
|
|
|
29
29
|
createText,
|
|
30
30
|
createTrigger,
|
|
31
31
|
} from '@dxos/react-ui-canvas-compute';
|
|
32
|
-
import {
|
|
33
|
-
CanvasBoardType,
|
|
34
|
-
CanvasGraphModel,
|
|
35
|
-
pointMultiply,
|
|
36
|
-
pointsToRect,
|
|
37
|
-
rectToPoints,
|
|
38
|
-
} from '@dxos/react-ui-canvas-editor';
|
|
32
|
+
import { CanvasBoard, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from '@dxos/react-ui-canvas-editor';
|
|
39
33
|
import { View } from '@dxos/schema';
|
|
40
|
-
import { Message, Organization, Person,
|
|
34
|
+
import { Message, Organization, Person, Pipeline } from '@dxos/types';
|
|
41
35
|
import { range, trim } from '@dxos/util';
|
|
42
36
|
|
|
43
37
|
import { type ObjectGenerator } from './ObjectGenerator';
|
|
@@ -57,14 +51,19 @@ export enum PresetName {
|
|
|
57
51
|
}
|
|
58
52
|
|
|
59
53
|
export const generator = () => ({
|
|
60
|
-
schemas: [
|
|
54
|
+
schemas: [CanvasBoard.CanvasBoard, Trigger.Trigger] as any[],
|
|
61
55
|
types: Object.values(PresetName).map((name) => ({ typename: name })),
|
|
62
56
|
items: [
|
|
63
57
|
[
|
|
64
58
|
PresetName.DXOS_TEAM,
|
|
65
59
|
async (space, n, cb) => {
|
|
66
60
|
const objects = range(n, () => {
|
|
67
|
-
const org = space.db.add(
|
|
61
|
+
const org = space.db.add(
|
|
62
|
+
Obj.make(Organization.Organization, {
|
|
63
|
+
name: 'DXOS',
|
|
64
|
+
website: 'https://dxos.org',
|
|
65
|
+
}),
|
|
66
|
+
);
|
|
68
67
|
const doc = space.db.add(
|
|
69
68
|
Markdown.make({
|
|
70
69
|
name: 'DXOS Research',
|
|
@@ -74,7 +73,9 @@ export const generator = () => ({
|
|
|
74
73
|
|
|
75
74
|
const tag = space.db.add(Tag.make({ label: 'Investor' }));
|
|
76
75
|
const tagDxn = Obj.getDXN(tag).toString();
|
|
77
|
-
Obj.
|
|
76
|
+
Obj.change(doc, (d) => {
|
|
77
|
+
Obj.getMeta(d).tags = [tagDxn];
|
|
78
|
+
});
|
|
78
79
|
|
|
79
80
|
// space.db.add(
|
|
80
81
|
// Relation.make(HasSubject, {
|
|
@@ -85,9 +86,24 @@ export const generator = () => ({
|
|
|
85
86
|
// );
|
|
86
87
|
|
|
87
88
|
space.db.add(Obj.make(Person.Person, { fullName: 'Rich', organization: Ref.make(org) }, { tags: [tagDxn] }));
|
|
88
|
-
space.db.add(
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
space.db.add(
|
|
90
|
+
Obj.make(Person.Person, {
|
|
91
|
+
fullName: 'Josiah',
|
|
92
|
+
organization: Ref.make(org),
|
|
93
|
+
}),
|
|
94
|
+
);
|
|
95
|
+
space.db.add(
|
|
96
|
+
Obj.make(Person.Person, {
|
|
97
|
+
fullName: 'Dima',
|
|
98
|
+
organization: Ref.make(org),
|
|
99
|
+
}),
|
|
100
|
+
);
|
|
101
|
+
space.db.add(
|
|
102
|
+
Obj.make(Person.Person, {
|
|
103
|
+
fullName: 'Mykola',
|
|
104
|
+
organization: Ref.make(org),
|
|
105
|
+
}),
|
|
106
|
+
);
|
|
91
107
|
|
|
92
108
|
return doc;
|
|
93
109
|
});
|
|
@@ -116,7 +132,7 @@ export const generator = () => ({
|
|
|
116
132
|
},
|
|
117
133
|
function: Ref.make(serializeFunction(gmail.sync)),
|
|
118
134
|
input: {
|
|
119
|
-
|
|
135
|
+
mailbox: Ref.make(mailbox),
|
|
120
136
|
},
|
|
121
137
|
}),
|
|
122
138
|
);
|
|
@@ -175,7 +191,9 @@ export const generator = () => ({
|
|
|
175
191
|
|
|
176
192
|
const mailboxView = View.make({
|
|
177
193
|
query: Query.select(
|
|
178
|
-
Filter.type(Message.Message, {
|
|
194
|
+
Filter.type(Message.Message, {
|
|
195
|
+
properties: { labels: Filter.contains('investor') },
|
|
196
|
+
}),
|
|
179
197
|
).options({
|
|
180
198
|
queues: [mailbox.queue.dxn.toString()],
|
|
181
199
|
}),
|
|
@@ -195,7 +213,7 @@ export const generator = () => ({
|
|
|
195
213
|
});
|
|
196
214
|
|
|
197
215
|
return space.db.add(
|
|
198
|
-
|
|
216
|
+
Pipeline.make({
|
|
199
217
|
name: 'Investor Research',
|
|
200
218
|
columns: [
|
|
201
219
|
{
|
|
@@ -247,10 +265,24 @@ export const generator = () => ({
|
|
|
247
265
|
const append = canvasModel.createNode(createAppend(position({ x: 10, y: 6 })));
|
|
248
266
|
|
|
249
267
|
builder
|
|
250
|
-
.createEdge({
|
|
268
|
+
.createEdge({
|
|
269
|
+
source: trigger.id,
|
|
270
|
+
target: gpt.id,
|
|
271
|
+
input: 'prompt',
|
|
272
|
+
output: 'bodyText',
|
|
273
|
+
})
|
|
251
274
|
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
252
|
-
.createEdge({
|
|
253
|
-
|
|
275
|
+
.createEdge({
|
|
276
|
+
source: queueId.id,
|
|
277
|
+
target: append.id,
|
|
278
|
+
input: 'id',
|
|
279
|
+
})
|
|
280
|
+
.createEdge({
|
|
281
|
+
source: gpt.id,
|
|
282
|
+
target: append.id,
|
|
283
|
+
output: 'messages',
|
|
284
|
+
input: 'items',
|
|
285
|
+
});
|
|
254
286
|
|
|
255
287
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
256
288
|
});
|
|
@@ -275,7 +307,7 @@ export const generator = () => ({
|
|
|
275
307
|
'subscription',
|
|
276
308
|
(triggerSpec) =>
|
|
277
309
|
(triggerSpec.query = {
|
|
278
|
-
ast: Query.select(Filter.typename('dxos.org/type/Chess')).ast
|
|
310
|
+
ast: Query.select(Filter.typename('dxos.org/type/Chess')).ast as Obj.Mutable<QueryAST.Query>,
|
|
279
311
|
}),
|
|
280
312
|
'type',
|
|
281
313
|
);
|
|
@@ -388,8 +420,17 @@ export const generator = () => ({
|
|
|
388
420
|
builder
|
|
389
421
|
.createEdge({ source: chat.id, target: gpt.id, input: 'prompt' })
|
|
390
422
|
.createEdge({ source: gpt.id, target: text.id, output: 'text' })
|
|
391
|
-
.createEdge({
|
|
392
|
-
|
|
423
|
+
.createEdge({
|
|
424
|
+
source: queueId.id,
|
|
425
|
+
target: append.id,
|
|
426
|
+
input: 'id',
|
|
427
|
+
})
|
|
428
|
+
.createEdge({
|
|
429
|
+
source: gpt.id,
|
|
430
|
+
target: append.id,
|
|
431
|
+
output: 'messages',
|
|
432
|
+
input: 'items',
|
|
433
|
+
});
|
|
393
434
|
});
|
|
394
435
|
|
|
395
436
|
const computeModel = createComputeGraph(canvasModel);
|
|
@@ -513,9 +554,21 @@ export const generator = () => ({
|
|
|
513
554
|
const view = canvasModel.createNode(createSurface(position({ x: 12, y: 0 })));
|
|
514
555
|
|
|
515
556
|
builder
|
|
516
|
-
.createEdge({
|
|
517
|
-
|
|
518
|
-
|
|
557
|
+
.createEdge({
|
|
558
|
+
source: sourceCurrency.id,
|
|
559
|
+
target: converter.id,
|
|
560
|
+
input: 'from',
|
|
561
|
+
})
|
|
562
|
+
.createEdge({
|
|
563
|
+
source: targetCurrency.id,
|
|
564
|
+
target: converter.id,
|
|
565
|
+
input: 'to',
|
|
566
|
+
})
|
|
567
|
+
.createEdge({
|
|
568
|
+
source: converter.id,
|
|
569
|
+
target: view.id,
|
|
570
|
+
output: 'rate',
|
|
571
|
+
});
|
|
519
572
|
});
|
|
520
573
|
|
|
521
574
|
const computeModel = createComputeGraph(canvasModel);
|
|
@@ -543,7 +596,10 @@ export const generator = () => ({
|
|
|
543
596
|
const trigger = canvasModel.createNode(triggerShape);
|
|
544
597
|
// DXOS dev-null channel.
|
|
545
598
|
const channelId = canvasModel.createNode(
|
|
546
|
-
createConstant({
|
|
599
|
+
createConstant({
|
|
600
|
+
value: '1088569858767212554',
|
|
601
|
+
...position({ x: -10, y: 0 }),
|
|
602
|
+
}),
|
|
547
603
|
);
|
|
548
604
|
const queueId = canvasModel.createNode(
|
|
549
605
|
createConstant({
|
|
@@ -556,11 +612,31 @@ export const generator = () => ({
|
|
|
556
612
|
const queue = canvasModel.createNode(createQueue(position({ x: 0, y: 12 })));
|
|
557
613
|
|
|
558
614
|
builder
|
|
559
|
-
.createEdge({
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
615
|
+
.createEdge({
|
|
616
|
+
source: trigger.id,
|
|
617
|
+
target: converter.id,
|
|
618
|
+
input: 'tick',
|
|
619
|
+
})
|
|
620
|
+
.createEdge({
|
|
621
|
+
source: channelId.id,
|
|
622
|
+
target: converter.id,
|
|
623
|
+
input: 'channelId',
|
|
624
|
+
})
|
|
625
|
+
.createEdge({
|
|
626
|
+
source: queueId.id,
|
|
627
|
+
target: converter.id,
|
|
628
|
+
input: 'queueId',
|
|
629
|
+
})
|
|
630
|
+
.createEdge({
|
|
631
|
+
source: converter.id,
|
|
632
|
+
target: view.id,
|
|
633
|
+
output: 'newMessages',
|
|
634
|
+
})
|
|
635
|
+
.createEdge({
|
|
636
|
+
source: queueId.id,
|
|
637
|
+
target: queue.id,
|
|
638
|
+
input: 'input',
|
|
639
|
+
});
|
|
564
640
|
|
|
565
641
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
566
642
|
});
|
|
@@ -630,7 +706,7 @@ export const generator = () => ({
|
|
|
630
706
|
const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
631
707
|
space: Space,
|
|
632
708
|
triggerKind: SpecType,
|
|
633
|
-
initSpec: (spec: Extract<Trigger.Spec, { kind: SpecType }
|
|
709
|
+
initSpec: (spec: Obj.Mutable<Extract<Trigger.Spec, { kind: SpecType }>>) => void,
|
|
634
710
|
triggerOutputName: string,
|
|
635
711
|
) => {
|
|
636
712
|
const canvasModel = CanvasGraphModel.create<ComputeShape>();
|
|
@@ -663,7 +739,12 @@ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
|
663
739
|
builder
|
|
664
740
|
.createEdge({ source: queueId.id, target: append.id, input: 'id' })
|
|
665
741
|
.createEdge({ source: template.id, target: append.id, input: 'items' })
|
|
666
|
-
.createEdge({
|
|
742
|
+
.createEdge({
|
|
743
|
+
source: trigger.id,
|
|
744
|
+
target: template.id,
|
|
745
|
+
output: triggerOutputName,
|
|
746
|
+
input: 'type',
|
|
747
|
+
})
|
|
667
748
|
.createEdge({
|
|
668
749
|
source: random.id,
|
|
669
750
|
target: template.id,
|
|
@@ -673,13 +754,16 @@ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
|
673
754
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
674
755
|
const triggerSpec = functionTrigger.spec;
|
|
675
756
|
invariant(triggerSpec && triggerSpec.kind === triggerKind, 'No trigger spec.');
|
|
676
|
-
|
|
757
|
+
Obj.change(functionTrigger, (ft) => {
|
|
758
|
+
initSpec(ft.spec as any);
|
|
759
|
+
});
|
|
677
760
|
});
|
|
678
761
|
|
|
679
762
|
const computeModel = createComputeGraph(canvasModel);
|
|
680
763
|
|
|
681
764
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
682
765
|
invariant(templateComputeNode, 'Template compute node was not created.');
|
|
766
|
+
// NOTE: These are plain object mutations during model construction, not ECHO object mutations.
|
|
683
767
|
templateComputeNode.value = ['{', ' "@type": "{{type}}",', ' "id": "@{{changeId}}"', '}'].join('\n');
|
|
684
768
|
templateComputeNode.inputSchema = Type.toJsonSchema(Schema.Struct({ type: Schema.String, changeId: Schema.String }));
|
|
685
769
|
attachTrigger(functionTrigger, computeModel);
|
|
@@ -689,7 +773,7 @@ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
|
689
773
|
|
|
690
774
|
const addToSpace = (name: string, space: Space, canvas: CanvasGraphModel, compute: ComputeGraphModel) => {
|
|
691
775
|
return space.db.add(
|
|
692
|
-
Obj.make(
|
|
776
|
+
Obj.make(CanvasBoard.CanvasBoard, {
|
|
693
777
|
name,
|
|
694
778
|
computeGraph: Ref.make(compute.root),
|
|
695
779
|
layout: canvas.graph,
|
|
@@ -719,15 +803,25 @@ const setupQueue = (
|
|
|
719
803
|
|
|
720
804
|
const attachTrigger = (functionTrigger: Trigger.Trigger | undefined, computeModel: ComputeGraphModel) => {
|
|
721
805
|
invariant(functionTrigger);
|
|
722
|
-
functionTrigger.function = Ref.make(computeModel.root);
|
|
723
806
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
|
|
724
|
-
functionTrigger
|
|
807
|
+
Obj.change(functionTrigger, (t) => {
|
|
808
|
+
t.function = Ref.make(computeModel.root);
|
|
809
|
+
t.inputNodeId = inputNode.id;
|
|
810
|
+
});
|
|
725
811
|
};
|
|
726
812
|
|
|
727
|
-
type RawPositionInput = {
|
|
813
|
+
type RawPositionInput = {
|
|
814
|
+
centerX: number;
|
|
815
|
+
centerY: number;
|
|
816
|
+
width: number;
|
|
817
|
+
height: number;
|
|
818
|
+
};
|
|
728
819
|
|
|
729
820
|
const rawPosition = (args: RawPositionInput) => {
|
|
730
|
-
return {
|
|
821
|
+
return {
|
|
822
|
+
center: { x: args.centerX, y: args.centerY },
|
|
823
|
+
size: { width: args.width, height: args.height },
|
|
824
|
+
};
|
|
731
825
|
};
|
|
732
826
|
|
|
733
827
|
const position = (rect: { x: number; y: number; width?: number; height?: number }) => {
|
|
@@ -735,7 +829,10 @@ const position = (rect: { x: number; y: number; width?: number; height?: number
|
|
|
735
829
|
const [center, size] = rectToPoints({ width: 0, height: 0, ...rect });
|
|
736
830
|
const { x, y, width, height } = pointsToRect([pointMultiply(center, snap), pointMultiply(size, snap)]);
|
|
737
831
|
if (width && height) {
|
|
738
|
-
return {
|
|
832
|
+
return {
|
|
833
|
+
center: { x, y },
|
|
834
|
+
size: width && height ? { width, height } : undefined,
|
|
835
|
+
};
|
|
739
836
|
} else {
|
|
740
837
|
return { center: { x, y } };
|
|
741
838
|
}
|
|
@@ -9,11 +9,11 @@ import { Obj } from '@dxos/echo';
|
|
|
9
9
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
10
10
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
11
11
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
12
|
-
import { mx } from '@dxos/
|
|
12
|
+
import { mx } from '@dxos/ui-theme';
|
|
13
13
|
|
|
14
14
|
// TODO(burdon): Create generic container with wireframe mode.
|
|
15
15
|
export type WireframeProps = ThemedClassName<{
|
|
16
|
-
object: Obj.
|
|
16
|
+
object: Obj.Unknown;
|
|
17
17
|
label?: string;
|
|
18
18
|
}>;
|
|
19
19
|
|
package/src/components/index.ts
CHANGED
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { lazy } from 'react';
|
|
6
|
+
import { type FC } from 'react';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
import { type DebugGraphProps } from './DebugGraph';
|
|
9
|
+
|
|
10
|
+
export const DebugGraph: ReturnType<typeof lazy<FC<DebugGraphProps>>> = lazy(() => import('./DebugGraph'));
|
|
8
11
|
export const DevtoolsOverviewContainer = lazy(() => import('./DevtoolsOverviewContainer'));
|
|
9
12
|
export const SpaceGenerator = lazy(() => import('./SpaceGenerator'));
|
|
10
13
|
|
package/src/meta.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
export const meta:
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
9
|
id: 'dxos.org/plugin/debug',
|
|
10
10
|
name: 'Debug',
|
|
11
11
|
description: trim`
|
package/src/types.ts
CHANGED
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
5
6
|
import * as Schema from 'effect/Schema';
|
|
6
7
|
import { type Context, createContext } from 'react';
|
|
7
8
|
|
|
9
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
10
|
import type { TimerCallback, TimerOptions } from '@dxos/async';
|
|
9
11
|
|
|
12
|
+
import { meta } from './meta';
|
|
13
|
+
|
|
10
14
|
export type DebugContextType = {
|
|
11
15
|
running: boolean;
|
|
12
16
|
start: (cb: TimerCallback, options: TimerOptions) => void;
|
|
@@ -27,6 +31,10 @@ export const DebugSettingsSchema = Schema.mutable(
|
|
|
27
31
|
|
|
28
32
|
export interface DebugSettingsProps extends Schema.Schema.Type<typeof DebugSettingsSchema> {}
|
|
29
33
|
|
|
34
|
+
export namespace DebugCapabilities {
|
|
35
|
+
export const Settings = Capability.make<Atom.Writable<DebugSettingsProps>>(`${meta.id}/capability/settings`);
|
|
36
|
+
}
|
|
37
|
+
|
|
30
38
|
export namespace Devtools {
|
|
31
39
|
// TODO(wittjosiah): Cannot use slashes in ids until we have a router which decouples ids from url paths.
|
|
32
40
|
export const id = 'dxos.org.plugin.debug.devtools';
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
|
@@ -1,7 +0,0 @@
|
|
|
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,25 +0,0 @@
|
|
|
1
|
-
// src/components/DevtoolsOverviewContainer.tsx
|
|
2
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { Surface } from "@dxos/app-framework/react";
|
|
5
|
-
import { StatsPanel, useStats } from "@dxos/devtools";
|
|
6
|
-
var DevtoolsOverviewContainer = () => {
|
|
7
|
-
var _effect = _useSignals();
|
|
8
|
-
try {
|
|
9
|
-
const [stats, refreshStats] = useStats();
|
|
10
|
-
return /* @__PURE__ */ React.createElement(StatsPanel, {
|
|
11
|
-
stats,
|
|
12
|
-
onRefresh: refreshStats
|
|
13
|
-
}, /* @__PURE__ */ React.createElement(Surface, {
|
|
14
|
-
role: "devtools-overview"
|
|
15
|
-
}));
|
|
16
|
-
} finally {
|
|
17
|
-
_effect.f();
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
var DevtoolsOverviewContainer_default = DevtoolsOverviewContainer;
|
|
21
|
-
export {
|
|
22
|
-
DevtoolsOverviewContainer,
|
|
23
|
-
DevtoolsOverviewContainer_default as default
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=DevtoolsOverviewContainer-JXVZVPHN.mjs.map
|