@dxos/plugin-debug 0.8.4-main.c85a9c8dae → 0.8.4-main.d9fc60f731
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/LICENSE +102 -5
- package/PLUGIN.mdl +373 -0
- package/README.md +1 -1
- package/dist/lib/{browser/DebugGraph-7HXJ2PS2.mjs → neutral/DebugGraph-G4FWS57E.mjs} +4 -5
- package/dist/lib/neutral/DebugGraph-G4FWS57E.mjs.map +7 -0
- package/dist/lib/neutral/DebugObjectPanel-OS65NC4M.mjs +59 -0
- package/dist/lib/neutral/DebugObjectPanel-OS65NC4M.mjs.map +7 -0
- package/dist/lib/neutral/DebugPlugin.mjs +59 -0
- package/dist/lib/neutral/DebugPlugin.mjs.map +7 -0
- package/dist/lib/neutral/DebugPlugin.node.mjs +18 -0
- package/dist/lib/neutral/DebugPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/DebugPlugin.workerd.mjs +12 -0
- package/dist/lib/neutral/DebugPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/DebugSettings-RKYNQIKH.mjs +223 -0
- package/dist/lib/neutral/DebugSettings-RKYNQIKH.mjs.map +7 -0
- package/dist/lib/{browser/DebugSpaceObjectsPanel-7NRPLWZ4.mjs → neutral/DebugSpaceObjectsPanel-BHOCFWDJ.mjs} +10 -26
- package/dist/lib/neutral/DebugSpaceObjectsPanel-BHOCFWDJ.mjs.map +7 -0
- package/dist/lib/{browser/DebugStatus-COQGH37G.mjs → neutral/DebugStatus-H2BAHN26.mjs} +36 -39
- package/dist/lib/neutral/DebugStatus-H2BAHN26.mjs.map +7 -0
- package/dist/lib/{browser/DevtoolsOverviewContainer-C75NFVER.mjs → neutral/DevtoolsOverviewContainer-YX7Z3D2H.mjs} +9 -6
- package/dist/lib/neutral/DevtoolsOverviewContainer-YX7Z3D2H.mjs.map +7 -0
- package/dist/lib/neutral/GithubPanel-QJKDJRVQ.mjs +177 -0
- package/dist/lib/neutral/GithubPanel-QJKDJRVQ.mjs.map +7 -0
- package/dist/lib/neutral/RegistryPanel-64GIYJHN.mjs +161 -0
- package/dist/lib/neutral/RegistryPanel-64GIYJHN.mjs.map +7 -0
- package/dist/lib/neutral/SpaceGenerator-Y35G6DRV.mjs +146 -0
- package/dist/lib/neutral/SpaceGenerator-Y35G6DRV.mjs.map +7 -0
- package/dist/lib/{browser/Wireframe-KAGOKEFW.mjs → neutral/Wireframe-WD7S2AUU.mjs} +9 -10
- package/dist/lib/neutral/Wireframe-WD7S2AUU.mjs.map +7 -0
- package/dist/lib/{browser/app-graph-builder-LGUQNXHD.mjs → neutral/app-graph-builder-XYLTBYKN.mjs} +246 -259
- package/dist/lib/neutral/app-graph-builder-XYLTBYKN.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +15 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-HOV6MV5B.mjs +43 -0
- package/dist/lib/neutral/chunk-HOV6MV5B.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/{browser/chunk-4UFQXPP7.mjs → neutral/chunk-UAAGABXZ.mjs} +24 -12
- package/dist/lib/neutral/chunk-UAAGABXZ.mjs.map +7 -0
- package/dist/lib/{browser/SpaceGenerator-SWSGJEEL.mjs → neutral/components/index.mjs} +90 -292
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +25 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +18 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +12 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/{browser/react-context-I3USIAF6.mjs → neutral/react-context-MUZ3KVLU.mjs} +6 -6
- package/dist/lib/neutral/react-context-MUZ3KVLU.mjs.map +7 -0
- package/dist/lib/{browser/react-surface-BTVNKKVQ.mjs → neutral/react-surface-3MDMZGCA.mjs} +162 -180
- package/dist/lib/neutral/react-surface-3MDMZGCA.mjs.map +7 -0
- package/dist/lib/{browser/settings-SLTQJJNF.mjs → neutral/settings-MPM6YUP4.mjs} +7 -11
- package/dist/lib/neutral/settings-MPM6YUP4.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +91 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +14 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/src/DebugPlugin.d.ts +2 -5
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/DebugPlugin.node.d.ts +5 -0
- package/dist/types/src/DebugPlugin.node.d.ts.map +1 -0
- package/dist/types/src/DebugPlugin.test.d.ts +2 -0
- package/dist/types/src/DebugPlugin.test.d.ts.map +1 -0
- package/dist/types/src/DebugPlugin.workerd.d.ts +5 -0
- package/dist/types/src/DebugPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +11 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/{settings/settings.d.ts → settings.d.ts} +2 -1
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.d.ts +11 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts +106 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings/index.d.ts +2 -0
- package/dist/types/src/components/DebugSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/SchemaTable/SchemaTable.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +3 -4
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.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.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts +2 -2
- package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts.map +1 -1
- package/dist/types/src/containers/DebugGraph/index.d.ts +1 -2
- package/dist/types/src/containers/DebugGraph/index.d.ts.map +1 -1
- package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts +3 -4
- package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/containers/DebugObjectPanel/index.d.ts +1 -2
- package/dist/types/src/containers/DebugObjectPanel/index.d.ts.map +1 -1
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +3 -1
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -1
- package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts +1 -2
- package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts.map +1 -1
- package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts.map +1 -1
- package/dist/types/src/containers/DebugStatus/index.d.ts +1 -2
- package/dist/types/src/containers/DebugStatus/index.d.ts.map +1 -1
- package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts.map +1 -1
- package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts +1 -2
- package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/GithubPanel/GithubComponent.d.ts +15 -0
- package/dist/types/src/containers/GithubPanel/GithubComponent.d.ts.map +1 -0
- package/dist/types/src/containers/GithubPanel/GithubComponent.stories.d.ts +106 -0
- package/dist/types/src/containers/GithubPanel/GithubComponent.stories.d.ts.map +1 -0
- package/dist/types/src/containers/GithubPanel/GithubPanel.d.ts +3 -0
- package/dist/types/src/containers/GithubPanel/GithubPanel.d.ts.map +1 -0
- package/dist/types/src/containers/GithubPanel/index.d.ts +2 -0
- package/dist/types/src/containers/GithubPanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/RegistryPanel/RegistryPanel.d.ts +3 -0
- package/dist/types/src/containers/RegistryPanel/RegistryPanel.d.ts.map +1 -0
- package/dist/types/src/containers/RegistryPanel/index.d.ts +2 -0
- package/dist/types/src/containers/RegistryPanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts +3 -1
- package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/containers/SpaceGenerator/index.d.ts +1 -2
- package/dist/types/src/containers/SpaceGenerator/index.d.ts.map +1 -1
- package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -1
- package/dist/types/src/containers/Wireframe/index.d.ts +1 -2
- package/dist/types/src/containers/Wireframe/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +2 -1
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +87 -61
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +8 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +70 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +112 -71
- package/src/DebugPlugin.node.ts +18 -0
- package/src/DebugPlugin.test.ts +29 -0
- package/src/DebugPlugin.tsx +14 -10
- package/src/DebugPlugin.workerd.ts +12 -0
- package/src/capabilities/app-graph-builder.ts +433 -0
- package/src/capabilities/index.ts +6 -4
- package/src/capabilities/{react-context/react-context.tsx → react-context.tsx} +7 -2
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +179 -161
- package/src/capabilities/{settings/settings.ts → settings.ts} +4 -4
- package/src/components/DebugSettings/DebugSettings.stories.tsx +36 -0
- package/src/components/DebugSettings/DebugSettings.tsx +259 -0
- package/src/components/DebugSettings/index.ts +5 -0
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +28 -28
- package/src/components/SpaceGenerator/draw-util.ts +8 -8
- package/src/components/SpaceGenerator/presets.ts +39 -62
- package/src/components/index.ts +4 -0
- package/src/containers/DebugGraph/DebugGraph.tsx +3 -2
- package/src/containers/DebugGraph/index.ts +1 -3
- package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +49 -18
- package/src/containers/DebugObjectPanel/index.ts +1 -3
- package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +11 -24
- package/src/containers/DebugSpaceObjectsPanel/index.ts +1 -3
- package/src/containers/DebugStatus/DebugStatus.tsx +42 -19
- package/src/containers/DebugStatus/index.ts +1 -3
- package/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx +8 -1
- package/src/containers/DevtoolsOverviewContainer/index.ts +1 -3
- package/src/containers/GithubPanel/GithubComponent.stories.tsx +38 -0
- package/src/containers/GithubPanel/GithubComponent.tsx +192 -0
- package/src/containers/GithubPanel/GithubPanel.tsx +17 -0
- package/src/containers/GithubPanel/index.ts +5 -0
- package/src/containers/RegistryPanel/RegistryPanel.tsx +150 -0
- package/src/containers/RegistryPanel/index.ts +5 -0
- package/src/containers/SpaceGenerator/SpaceGenerator.tsx +104 -104
- package/src/containers/SpaceGenerator/index.ts +1 -3
- package/src/containers/Wireframe/Wireframe.tsx +3 -7
- package/src/containers/Wireframe/index.ts +1 -3
- package/src/containers/index.ts +2 -1
- package/src/index.ts +1 -1
- package/src/meta.ts +26 -6
- package/src/plugin.ts +10 -0
- package/src/translations.ts +83 -60
- package/src/types/Settings.ts +16 -0
- package/src/{types.ts → types/index.ts} +16 -14
- package/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/DebugGraph-7HXJ2PS2.mjs.map +0 -7
- package/dist/lib/browser/DebugObjectPanel-3TCDNUNW.mjs +0 -33
- package/dist/lib/browser/DebugObjectPanel-3TCDNUNW.mjs.map +0 -7
- package/dist/lib/browser/DebugSettings-JZMIUDYB.mjs +0 -174
- package/dist/lib/browser/DebugSettings-JZMIUDYB.mjs.map +0 -7
- package/dist/lib/browser/DebugSpaceObjectsPanel-7NRPLWZ4.mjs.map +0 -7
- package/dist/lib/browser/DebugStatus-COQGH37G.mjs.map +0 -7
- package/dist/lib/browser/DevtoolsOverviewContainer-C75NFVER.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-SWSGJEEL.mjs.map +0 -7
- package/dist/lib/browser/Wireframe-KAGOKEFW.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-LGUQNXHD.mjs.map +0 -7
- package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +0 -7
- package/dist/lib/browser/chunk-A5H5GRV6.mjs +0 -20
- package/dist/lib/browser/chunk-A5H5GRV6.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -132
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-context-I3USIAF6.mjs.map +0 -7
- package/dist/lib/browser/react-surface-BTVNKKVQ.mjs.map +0 -7
- package/dist/lib/browser/settings-SLTQJJNF.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-context/index.d.ts +0 -7
- package/dist/types/src/capabilities/react-context/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-context/react-context.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -3
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
- package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts +0 -10
- package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts.map +0 -1
- package/dist/types/src/containers/DebugSettings/index.d.ts +0 -3
- package/dist/types/src/containers/DebugSettings/index.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -68
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -441
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/react-context/index.ts +0 -7
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/settings/index.ts +0 -7
- package/src/containers/DebugSettings/DebugSettings.tsx +0 -201
- package/src/containers/DebugSettings/index.ts +0 -7
- /package/dist/types/src/capabilities/{app-graph-builder/app-graph-builder.d.ts → app-graph-builder.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-context/react-context.d.ts → react-context.d.ts} +0 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { AppCapabilities, getPersonalSpace } from '@dxos/app-toolkit';
|
|
8
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
9
|
+
import { type ConfigProto, SaveConfig, Storage, defs } from '@dxos/config';
|
|
10
|
+
import { log } from '@dxos/log';
|
|
11
|
+
import { type IdbLogStore } from '@dxos/log-store-idb';
|
|
12
|
+
import { useClient } from '@dxos/react-client';
|
|
13
|
+
import { IconButton, Input, Select, Toast, useFileDownload, useTranslation } from '@dxos/react-ui';
|
|
14
|
+
import { Settings as SettingsForm } from '@dxos/react-ui-form';
|
|
15
|
+
import { TRACE_ALL_KEY } from '@dxos/tracing';
|
|
16
|
+
import { setDeep } from '@dxos/util';
|
|
17
|
+
|
|
18
|
+
import { meta } from '#meta';
|
|
19
|
+
import { type Settings } from '#types';
|
|
20
|
+
|
|
21
|
+
type Toast = {
|
|
22
|
+
title: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const StorageAdapters = {
|
|
27
|
+
opfs: defs.Runtime.Client.Storage.StorageDriver.WEBFS,
|
|
28
|
+
idb: defs.Runtime.Client.Storage.StorageDriver.IDB,
|
|
29
|
+
} as const;
|
|
30
|
+
|
|
31
|
+
export type DebugSettingsProps = AppSurface.SettingsArticleProps<
|
|
32
|
+
Settings.Settings,
|
|
33
|
+
{
|
|
34
|
+
logStore: IdbLogStore;
|
|
35
|
+
onUpload?: AppCapabilities.FileUploader;
|
|
36
|
+
}
|
|
37
|
+
>;
|
|
38
|
+
|
|
39
|
+
export const DebugSettings = ({ settings, onSettingsChange, logStore, onUpload }: DebugSettingsProps) => {
|
|
40
|
+
const { t } = useTranslation(meta.id);
|
|
41
|
+
const [toast, setToast] = useState<Toast>();
|
|
42
|
+
const download = useFileDownload();
|
|
43
|
+
const [storageConfig, setStorageConfig] = useState<ConfigProto>({});
|
|
44
|
+
const client = useClient();
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
void Storage().then((config) => setStorageConfig(config));
|
|
48
|
+
}, []);
|
|
49
|
+
|
|
50
|
+
const handleToast = useCallback(
|
|
51
|
+
(toast: Toast) => {
|
|
52
|
+
setToast(toast);
|
|
53
|
+
const timer = setTimeout(() => setToast(undefined), 5_000);
|
|
54
|
+
return () => clearTimeout(timer);
|
|
55
|
+
},
|
|
56
|
+
[setToast],
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const handleDownload = useCallback(async () => {
|
|
60
|
+
const data = await client.diagnostics();
|
|
61
|
+
const file = new Blob([JSON.stringify(data, undefined, 2)], {
|
|
62
|
+
type: 'text/plain',
|
|
63
|
+
});
|
|
64
|
+
const fileName = `composer-${new Date().toISOString().replace(/\W/g, '-')}.json`;
|
|
65
|
+
download(file, fileName);
|
|
66
|
+
|
|
67
|
+
if (onUpload) {
|
|
68
|
+
const personalSpace = getPersonalSpace(client);
|
|
69
|
+
if (!personalSpace) {
|
|
70
|
+
log.error('no personal space available for upload');
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const info = await onUpload(personalSpace.db, new File([file], fileName));
|
|
74
|
+
if (!info) {
|
|
75
|
+
log.error('diagnostics failed to upload to IPFS');
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
handleToast({
|
|
79
|
+
title: t('settings.uploaded.message'),
|
|
80
|
+
description: t('settings.uploaded.description'),
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// TODO(nf): move to IpfsPlugin?
|
|
84
|
+
const url = client.config.values.runtime!.services!.ipfs!.gateway + '/' + info.cid;
|
|
85
|
+
void navigator.clipboard.writeText(url);
|
|
86
|
+
handleToast({
|
|
87
|
+
title: t('settings.uploaded.message'),
|
|
88
|
+
description: t('settings.uploaded.description'),
|
|
89
|
+
});
|
|
90
|
+
log.info('diagnostics', { url });
|
|
91
|
+
}
|
|
92
|
+
}, [client, download, handleToast, onUpload, t]);
|
|
93
|
+
|
|
94
|
+
const handleDownloadLogs = useCallback(async () => {
|
|
95
|
+
const ndjson = await logStore.export();
|
|
96
|
+
const file = new Blob([ndjson], { type: 'application/x-ndjson' });
|
|
97
|
+
const fileName = `composer-logs-${new Date().toISOString().slice(0, 19).replace(/:/g, '-')}.ndjson`;
|
|
98
|
+
download(file, fileName);
|
|
99
|
+
}, [download, logStore]);
|
|
100
|
+
|
|
101
|
+
const handleRepair = useCallback(async () => {
|
|
102
|
+
try {
|
|
103
|
+
const info = await client.repair();
|
|
104
|
+
setStorageConfig(await Storage());
|
|
105
|
+
handleToast({
|
|
106
|
+
title: t('settings.repair-success.message'),
|
|
107
|
+
description: JSON.stringify(info, undefined, 2),
|
|
108
|
+
});
|
|
109
|
+
} catch (err: any) {
|
|
110
|
+
handleToast({
|
|
111
|
+
title: t('settings.repair-failed.message'),
|
|
112
|
+
description: err.message,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}, [client, handleToast, t]);
|
|
116
|
+
|
|
117
|
+
const handleWireframeChange = useCallback(
|
|
118
|
+
(checked: boolean) => onSettingsChange?.((s) => ({ ...s, wireframe: !!checked })),
|
|
119
|
+
[onSettingsChange],
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const traceAll = useMemo(
|
|
123
|
+
() => settings.traceAll ?? (typeof localStorage !== 'undefined' && localStorage.getItem(TRACE_ALL_KEY) === 'true'),
|
|
124
|
+
[settings.traceAll],
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const handleTraceAllChange = useCallback(
|
|
128
|
+
(checked: boolean) => {
|
|
129
|
+
const value = !!checked;
|
|
130
|
+
localStorage.setItem(TRACE_ALL_KEY, String(value));
|
|
131
|
+
onSettingsChange?.((s) => ({ ...s, traceAll: value }));
|
|
132
|
+
},
|
|
133
|
+
[onSettingsChange],
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
const handleOpenTracingPanel = useCallback(() => {
|
|
137
|
+
window.open('about:blank', '_blank');
|
|
138
|
+
}, []);
|
|
139
|
+
|
|
140
|
+
const handleStorageAdapterChange = useCallback(
|
|
141
|
+
(value: string) => {
|
|
142
|
+
if (confirm(t('settings.storage-adapter.changed-alert.message'))) {
|
|
143
|
+
updateConfig(
|
|
144
|
+
storageConfig,
|
|
145
|
+
setStorageConfig,
|
|
146
|
+
['runtime', 'client', 'storage', 'dataStore'],
|
|
147
|
+
StorageAdapters[value as keyof typeof StorageAdapters],
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
[storageConfig, t],
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
<SettingsForm.Viewport>
|
|
156
|
+
<SettingsForm.Section title={t('settings.title', { ns: meta.id })}>
|
|
157
|
+
<SettingsForm.Item title={t('settings.wireframe.label')} description={t('settings.wireframe.description')}>
|
|
158
|
+
<Input.Switch
|
|
159
|
+
disabled={!onSettingsChange}
|
|
160
|
+
checked={settings.wireframe}
|
|
161
|
+
onCheckedChange={handleWireframeChange}
|
|
162
|
+
/>
|
|
163
|
+
</SettingsForm.Item>
|
|
164
|
+
<SettingsForm.Item title={t('settings.trace-all.label')} description={t('settings.trace-all.description')}>
|
|
165
|
+
<Input.Switch disabled={!onSettingsChange} checked={traceAll} onCheckedChange={handleTraceAllChange} />
|
|
166
|
+
</SettingsForm.Item>
|
|
167
|
+
<SettingsForm.Item
|
|
168
|
+
title={t('settings.tracing-panel.label')}
|
|
169
|
+
description={t('settings.tracing-panel.description')}
|
|
170
|
+
>
|
|
171
|
+
<IconButton
|
|
172
|
+
icon='ph--arrow-square-out--regular'
|
|
173
|
+
iconOnly
|
|
174
|
+
label={t('settings.tracing-panel.label')}
|
|
175
|
+
onClick={handleOpenTracingPanel}
|
|
176
|
+
/>
|
|
177
|
+
</SettingsForm.Item>
|
|
178
|
+
<SettingsForm.Item
|
|
179
|
+
title={t('settings.download-diagnostics.label')}
|
|
180
|
+
description={t('settings.download-diagnostics.description')}
|
|
181
|
+
>
|
|
182
|
+
<IconButton
|
|
183
|
+
icon='ph--download-simple--regular'
|
|
184
|
+
iconOnly
|
|
185
|
+
label={t('settings.download-diagnostics.label')}
|
|
186
|
+
onClick={handleDownload}
|
|
187
|
+
/>
|
|
188
|
+
</SettingsForm.Item>
|
|
189
|
+
<SettingsForm.Item
|
|
190
|
+
title={t('settings.download-logs.label')}
|
|
191
|
+
description={t('settings.download-logs.description')}
|
|
192
|
+
>
|
|
193
|
+
<IconButton
|
|
194
|
+
icon='ph--download-simple--regular'
|
|
195
|
+
iconOnly
|
|
196
|
+
label={t('settings.download-logs.label')}
|
|
197
|
+
onClick={handleDownloadLogs}
|
|
198
|
+
/>
|
|
199
|
+
</SettingsForm.Item>
|
|
200
|
+
<SettingsForm.Item title={t('settings.repair.label')} description={t('settings.repair.description')}>
|
|
201
|
+
<IconButton
|
|
202
|
+
icon='ph--first-aid-kit--regular'
|
|
203
|
+
iconOnly
|
|
204
|
+
label={t('settings.repair.label')}
|
|
205
|
+
onClick={handleRepair}
|
|
206
|
+
/>
|
|
207
|
+
</SettingsForm.Item>
|
|
208
|
+
|
|
209
|
+
{/* TODO(burdon): Move to layout? */}
|
|
210
|
+
{toast && (
|
|
211
|
+
<Toast.Root>
|
|
212
|
+
<Toast.Title icon='ph--gift--duotone'>
|
|
213
|
+
<span>{toast.title}</span>
|
|
214
|
+
</Toast.Title>
|
|
215
|
+
{toast.description && <Toast.Description>{toast.description}</Toast.Description>}
|
|
216
|
+
</Toast.Root>
|
|
217
|
+
)}
|
|
218
|
+
|
|
219
|
+
<SettingsForm.Item
|
|
220
|
+
title={t('settings.choose-storage-adaptor.label')}
|
|
221
|
+
description={t('settings.choose-storage-adaptor.description')}
|
|
222
|
+
>
|
|
223
|
+
<Select.Root
|
|
224
|
+
disabled={!onSettingsChange}
|
|
225
|
+
value={
|
|
226
|
+
Object.entries(StorageAdapters).find(
|
|
227
|
+
([_name, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore,
|
|
228
|
+
)?.[0]
|
|
229
|
+
}
|
|
230
|
+
onValueChange={handleStorageAdapterChange}
|
|
231
|
+
>
|
|
232
|
+
<Select.TriggerButton disabled={!onSettingsChange} placeholder={t('settings.data-store.label')} />
|
|
233
|
+
<Select.Portal>
|
|
234
|
+
<Select.Content>
|
|
235
|
+
<Select.Viewport>
|
|
236
|
+
{Object.keys(StorageAdapters).map((key) => (
|
|
237
|
+
<Select.Option key={key} value={key}>
|
|
238
|
+
{t(`settings.storage-adaptor.${key}.label`)}
|
|
239
|
+
</Select.Option>
|
|
240
|
+
))}
|
|
241
|
+
</Select.Viewport>
|
|
242
|
+
<Select.Arrow />
|
|
243
|
+
</Select.Content>
|
|
244
|
+
</Select.Portal>
|
|
245
|
+
</Select.Root>
|
|
246
|
+
</SettingsForm.Item>
|
|
247
|
+
</SettingsForm.Section>
|
|
248
|
+
</SettingsForm.Viewport>
|
|
249
|
+
);
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
const updateConfig = (config: ConfigProto, setConfig: (newConfig: ConfigProto) => void, path: string[], value: any) => {
|
|
253
|
+
const storageConfigCopy = JSON.parse(JSON.stringify(config ?? {}));
|
|
254
|
+
setDeep(storageConfigCopy, path, value);
|
|
255
|
+
setConfig(storageConfigCopy);
|
|
256
|
+
queueMicrotask(async () => {
|
|
257
|
+
await SaveConfig(storageConfigCopy);
|
|
258
|
+
});
|
|
259
|
+
};
|
|
@@ -2,25 +2,22 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
import { addressToA1Notation } from '@dxos/compute';
|
|
5
|
+
import { addressToA1Notation } from '@dxos/compute-hyperformula';
|
|
8
6
|
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from '@dxos/conductor';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { faker } from '@dxos/random';
|
|
7
|
+
import { EID, Filter, Key, Type, View } from '@dxos/echo';
|
|
8
|
+
import { OperationInvoker } from '@dxos/operation';
|
|
9
|
+
import { Markdown } from '@dxos/plugin-markdown';
|
|
10
|
+
import { Sheet } from '@dxos/plugin-sheet';
|
|
11
|
+
import { Sketch } from '@dxos/plugin-sketch';
|
|
12
|
+
import { SpaceOperation } from '@dxos/plugin-space';
|
|
13
|
+
import { random } from '@dxos/random';
|
|
17
14
|
import { type Client } from '@dxos/react-client';
|
|
18
15
|
import { type Space } from '@dxos/react-client/echo';
|
|
19
16
|
import { getTypenameFromQuery } from '@dxos/schema';
|
|
20
17
|
import { type ValueGenerator, createAsyncGenerator } from '@dxos/schema/testing';
|
|
21
18
|
import { range } from '@dxos/util';
|
|
22
19
|
|
|
23
|
-
const generator: ValueGenerator =
|
|
20
|
+
const generator: ValueGenerator = random as any;
|
|
24
21
|
|
|
25
22
|
const findViewByTypename = async (views: View.View[], typename: string) => {
|
|
26
23
|
return views.find((view) => getTypenameFromQuery(view.query.ast) === typename);
|
|
@@ -32,18 +29,21 @@ export const createGenerator = <S extends Type.AnyObj>(
|
|
|
32
29
|
client: Client,
|
|
33
30
|
invokePromise: OperationInvoker.OperationInvoker['invokePromise'],
|
|
34
31
|
schema: S,
|
|
35
|
-
): ObjectGenerator<
|
|
36
|
-
return async (space: Space, n: number): Promise<
|
|
37
|
-
const typename = schema
|
|
32
|
+
): ObjectGenerator<Type.InstanceType<S>> => {
|
|
33
|
+
return async (space: Space, n: number): Promise<Type.InstanceType<S>[]> => {
|
|
34
|
+
const typename = Type.getTypename(schema);
|
|
38
35
|
|
|
39
36
|
// Find or create table and view.
|
|
40
37
|
const views = await space.db.query(Filter.type(View.View)).run();
|
|
41
38
|
const view = await findViewByTypename(views, typename);
|
|
42
|
-
const staticSchema = client
|
|
39
|
+
const staticSchema = client
|
|
40
|
+
? client.graph.registry
|
|
41
|
+
.list()
|
|
42
|
+
.filter(Type.isType)
|
|
43
|
+
.find((s) => Type.getTypename(s) === typename)
|
|
44
|
+
: undefined;
|
|
43
45
|
if (!view && !staticSchema) {
|
|
44
|
-
await invokePromise(SpaceOperation.
|
|
45
|
-
} else if (!view && staticSchema) {
|
|
46
|
-
await invokePromise(SpaceOperation.UseStaticSchema, { db: space.db, typename, show: false });
|
|
46
|
+
await invokePromise(SpaceOperation.AddType, { db: space.db, type: schema, show: false });
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
// Create objects.
|
|
@@ -54,13 +54,13 @@ export const createGenerator = <S extends Type.AnyObj>(
|
|
|
54
54
|
|
|
55
55
|
export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
56
56
|
[
|
|
57
|
-
Markdown.Document
|
|
57
|
+
Type.getTypename(Markdown.Document),
|
|
58
58
|
async (space, n, cb) => {
|
|
59
59
|
const objects = range(n).map(() => {
|
|
60
60
|
return space.db.add(
|
|
61
61
|
Markdown.make({
|
|
62
|
-
name:
|
|
63
|
-
content:
|
|
62
|
+
name: random.commerce.productName(),
|
|
63
|
+
content: random.lorem.sentences(5),
|
|
64
64
|
}),
|
|
65
65
|
);
|
|
66
66
|
});
|
|
@@ -70,10 +70,10 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
70
70
|
},
|
|
71
71
|
],
|
|
72
72
|
[
|
|
73
|
-
|
|
73
|
+
Type.getTypename(Sketch.Sketch),
|
|
74
74
|
async (space, n, cb) => {
|
|
75
75
|
const objects = range(n).map(() => {
|
|
76
|
-
const obj = space.db.add(
|
|
76
|
+
const obj = space.db.add(Sketch.make({ name: random.commerce.productName() }));
|
|
77
77
|
return obj;
|
|
78
78
|
});
|
|
79
79
|
|
|
@@ -83,7 +83,7 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
83
83
|
],
|
|
84
84
|
// TODO(burdon): Create unit tests.
|
|
85
85
|
[
|
|
86
|
-
Sheet.Sheet
|
|
86
|
+
Type.getTypename(Sheet.Sheet),
|
|
87
87
|
async (space, n, cb) => {
|
|
88
88
|
const objects = range(n).map(() => {
|
|
89
89
|
const cells: Record<string, Sheet.CellValue> = {};
|
|
@@ -109,7 +109,7 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
109
109
|
// TODO(burdon): Set formatting for columns.
|
|
110
110
|
return space.db.add(
|
|
111
111
|
Sheet.make({
|
|
112
|
-
name:
|
|
112
|
+
name: random.commerce.productName(),
|
|
113
113
|
cells,
|
|
114
114
|
}),
|
|
115
115
|
);
|
|
@@ -120,7 +120,7 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
120
120
|
},
|
|
121
121
|
],
|
|
122
122
|
[
|
|
123
|
-
ComputeGraph
|
|
123
|
+
Type.getTypename(ComputeGraph),
|
|
124
124
|
async (space, n, cb) => {
|
|
125
125
|
const objects = range(n, () => {
|
|
126
126
|
const model = ComputeGraphModel.create();
|
|
@@ -130,7 +130,7 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
130
130
|
.createNode({
|
|
131
131
|
id: 'gpt-QUEUE_ID',
|
|
132
132
|
type: 'constant',
|
|
133
|
-
value:
|
|
133
|
+
value: EID.make({ spaceId: space.id, entityId: Key.EntityId.random() }),
|
|
134
134
|
})
|
|
135
135
|
.createNode({ id: 'gpt-APPEND', type: 'append' })
|
|
136
136
|
.createNode({ id: 'gpt-OUTPUT', type: NODE_OUTPUT })
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from '@antv/layout';
|
|
16
16
|
import { type Editor, type SerializedStore, type TLRecord, createBindingId, createShapeId } from '@tldraw/tldraw';
|
|
17
17
|
|
|
18
|
-
import {
|
|
18
|
+
import { random } from '@dxos/random';
|
|
19
19
|
import { isTruthy, range } from '@dxos/util';
|
|
20
20
|
|
|
21
21
|
// TODO(burdon): Graph layout:
|
|
@@ -32,10 +32,10 @@ import { isTruthy, range } from '@dxos/util';
|
|
|
32
32
|
// TODO(burdon): Factor out.
|
|
33
33
|
// TODO(burdon): Map ECHO to Graph.
|
|
34
34
|
export const generateGraph = (): Graph<PlainObject, PlainObject> => {
|
|
35
|
-
const nodes = range(
|
|
36
|
-
id:
|
|
35
|
+
const nodes = range(random.number.int({ min: 8, max: 32 })).map(() => ({
|
|
36
|
+
id: random.string.uuid(),
|
|
37
37
|
data: {
|
|
38
|
-
label:
|
|
38
|
+
label: random.lorem
|
|
39
39
|
.words(2)
|
|
40
40
|
.split(' ')
|
|
41
41
|
.map((word) => word.charAt(0).toUpperCase())
|
|
@@ -46,7 +46,7 @@ export const generateGraph = (): Graph<PlainObject, PlainObject> => {
|
|
|
46
46
|
const unlinked = new Set(nodes.map((node) => node.id));
|
|
47
47
|
const pop = () => {
|
|
48
48
|
if (unlinked.size) {
|
|
49
|
-
const id =
|
|
49
|
+
const id = random.helpers.arrayElement(Array.from(unlinked));
|
|
50
50
|
unlinked.delete(id);
|
|
51
51
|
return id;
|
|
52
52
|
}
|
|
@@ -54,12 +54,12 @@ export const generateGraph = (): Graph<PlainObject, PlainObject> => {
|
|
|
54
54
|
|
|
55
55
|
const edges: Edge<PlainObject>[] = [];
|
|
56
56
|
const link = (source: string, target: string) => {
|
|
57
|
-
edges.push({ id:
|
|
57
|
+
edges.push({ id: random.string.uuid(), source, target, data: {} });
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
const branching = 3;
|
|
61
61
|
const traverse = (source: string) => {
|
|
62
|
-
const targets = range(
|
|
62
|
+
const targets = range(random.number.int({ min: 1, max: branching }))
|
|
63
63
|
.map(() => {
|
|
64
64
|
const target = pop();
|
|
65
65
|
if (target) {
|
|
@@ -106,7 +106,7 @@ export const drawGraph = async (
|
|
|
106
106
|
preventOverlap: true,
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
-
const layoutType =
|
|
109
|
+
const layoutType = random.helpers.arrayElement(['d3force', 'grid', 'radial']);
|
|
110
110
|
let layout: Layout<any>;
|
|
111
111
|
switch (layoutType) {
|
|
112
112
|
case 'd3force': {
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { AgentPrompt, WebSearchBlueprint } from '@dxos/assistant-toolkit';
|
|
8
|
+
import { Routine, Trigger, Operation } from '@dxos/compute';
|
|
9
9
|
import { type ComputeGraphModel, NODE_INPUT } from '@dxos/conductor';
|
|
10
|
-
import {
|
|
11
|
-
import { Trigger, serializeFunction } from '@dxos/functions';
|
|
10
|
+
import { Feed, Filter, JsonSchema, Key, Obj, Query, type QueryAST, Ref, Scope, Tag } from '@dxos/echo';
|
|
12
11
|
import { invariant } from '@dxos/invariant';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
12
|
+
import { EID } from '@dxos/keys';
|
|
13
|
+
import { InboxOperation } from '@dxos/plugin-inbox';
|
|
14
|
+
import { Mailbox } from '@dxos/plugin-inbox';
|
|
15
|
+
import { Markdown } from '@dxos/plugin-markdown';
|
|
16
16
|
import { type Space } from '@dxos/react-client/echo';
|
|
17
17
|
import {
|
|
18
18
|
type ComputeShape,
|
|
@@ -20,9 +20,9 @@ import {
|
|
|
20
20
|
createChat,
|
|
21
21
|
createComputeGraph,
|
|
22
22
|
createConstant,
|
|
23
|
+
createFeed,
|
|
23
24
|
createFunction,
|
|
24
25
|
createGpt,
|
|
25
|
-
createQueue,
|
|
26
26
|
createRandom,
|
|
27
27
|
createSurface,
|
|
28
28
|
createTemplate,
|
|
@@ -72,9 +72,9 @@ export const generator = () => ({
|
|
|
72
72
|
);
|
|
73
73
|
|
|
74
74
|
const tag = space.db.add(Tag.make({ label: 'Investor' }));
|
|
75
|
-
const
|
|
76
|
-
Obj.
|
|
77
|
-
Obj.getMeta(
|
|
75
|
+
const tagRef = Ref.make(tag);
|
|
76
|
+
Obj.update(doc, (doc) => {
|
|
77
|
+
Obj.getMeta(doc).tags = [tagRef];
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
// space.db.add(
|
|
@@ -86,7 +86,7 @@ export const generator = () => ({
|
|
|
86
86
|
// );
|
|
87
87
|
|
|
88
88
|
space.db.add(
|
|
89
|
-
Obj.make(Person.Person, { [Obj.Meta]: { tags: [
|
|
89
|
+
Obj.make(Person.Person, { [Obj.Meta]: { tags: [tagRef] }, fullName: 'Rich', organization: Ref.make(org) }),
|
|
90
90
|
);
|
|
91
91
|
space.db.add(
|
|
92
92
|
Obj.make(Person.Person, {
|
|
@@ -116,50 +116,34 @@ export const generator = () => ({
|
|
|
116
116
|
[
|
|
117
117
|
PresetName.ORG_RESEARCH_PROJECT,
|
|
118
118
|
async (space, n, cb) => {
|
|
119
|
-
const
|
|
120
|
-
const mailbox =
|
|
121
|
-
invariant(mailbox, 'Mailbox
|
|
122
|
-
const
|
|
119
|
+
const mailboxes = await space.db.query(Filter.type(Mailbox.Mailbox)).run();
|
|
120
|
+
const mailbox = mailboxes[0];
|
|
121
|
+
invariant(mailbox, 'Mailbox not found');
|
|
122
|
+
const mailboxFeed = await mailbox.feed?.tryLoad();
|
|
123
|
+
invariant(mailboxFeed, 'Mailbox missing feed reference');
|
|
124
|
+
const queueDxn = Feed.getQueueUri(mailboxFeed);
|
|
123
125
|
invariant(queueDxn, 'Mailbox feed missing queue DXN key');
|
|
124
126
|
const tag = await space.db.query(Filter.type(Tag.Tag, { label: 'Investor' })).first();
|
|
125
|
-
const
|
|
127
|
+
const tagUri = Obj.getURI(tag);
|
|
126
128
|
|
|
127
129
|
const objects = range(n, () => {
|
|
128
|
-
const contactsQuery = Query.select(Filter.type(Person.Person)).select(Filter.tag(
|
|
129
|
-
const organizationsQuery = Query.select(Filter.type(Organization.Organization)).select(Filter.tag(
|
|
130
|
-
const notesQuery = Query.select(Filter.type(Markdown.Document)).select(Filter.tag(
|
|
130
|
+
const contactsQuery = Query.select(Filter.type(Person.Person)).select(Filter.tag(tagUri));
|
|
131
|
+
const organizationsQuery = Query.select(Filter.type(Organization.Organization)).select(Filter.tag(tagUri));
|
|
132
|
+
const notesQuery = Query.select(Filter.type(Markdown.Document)).select(Filter.tag(tagUri));
|
|
131
133
|
|
|
132
134
|
space.db.add(
|
|
133
135
|
Trigger.make({
|
|
134
136
|
enabled: true,
|
|
135
|
-
spec:
|
|
136
|
-
|
|
137
|
-
cron: '* * * * *', // Every minute.
|
|
138
|
-
},
|
|
139
|
-
function: Ref.make(serializeFunction(GmailFunctions.Sync)),
|
|
137
|
+
spec: Trigger.specTimer('* * * * *'), // Every minute.
|
|
138
|
+
function: Ref.make(Operation.serialize(InboxOperation.GoogleMailSync)),
|
|
140
139
|
input: {
|
|
141
140
|
mailbox: Ref.make(mailbox),
|
|
142
141
|
},
|
|
143
142
|
}),
|
|
144
143
|
);
|
|
145
144
|
|
|
146
|
-
space.db.add(
|
|
147
|
-
Trigger.make({
|
|
148
|
-
enabled: true,
|
|
149
|
-
// TODO(wittjosiah): Queue trigger doesn't support matching query of the column.
|
|
150
|
-
spec: {
|
|
151
|
-
kind: 'queue',
|
|
152
|
-
queue: queueDxn,
|
|
153
|
-
},
|
|
154
|
-
function: Ref.make(serializeFunction(EntityExtractionFunctions.Extract)),
|
|
155
|
-
input: {
|
|
156
|
-
source: '{{event.item}}',
|
|
157
|
-
},
|
|
158
|
-
}),
|
|
159
|
-
);
|
|
160
|
-
|
|
161
145
|
const researchPrompt = space.db.add(
|
|
162
|
-
|
|
146
|
+
Routine.make({
|
|
163
147
|
name: 'Research',
|
|
164
148
|
description: 'Research organization',
|
|
165
149
|
input: Schema.Struct({
|
|
@@ -174,20 +158,15 @@ export const generator = () => ({
|
|
|
174
158
|
Create a research note for it at the end.
|
|
175
159
|
NOTE: Do mocked reseach (set mockSearch to true).
|
|
176
160
|
`,
|
|
177
|
-
blueprints: [Ref.make(
|
|
161
|
+
blueprints: [Ref.make(WebSearchBlueprint.make())],
|
|
178
162
|
}),
|
|
179
163
|
);
|
|
180
164
|
|
|
181
165
|
space.db.add(
|
|
182
166
|
Trigger.make({
|
|
183
167
|
enabled: true,
|
|
184
|
-
spec:
|
|
185
|
-
|
|
186
|
-
query: {
|
|
187
|
-
ast: organizationsQuery.ast,
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
function: Ref.make(serializeFunction(AgentFunctions.Prompt)),
|
|
168
|
+
spec: Trigger.specSubscription(organizationsQuery),
|
|
169
|
+
function: Ref.make(Operation.serialize(AgentPrompt)),
|
|
191
170
|
input: {
|
|
192
171
|
prompt: Ref.make(researchPrompt),
|
|
193
172
|
input: '{{event.subject}}',
|
|
@@ -200,9 +179,7 @@ export const generator = () => ({
|
|
|
200
179
|
Filter.type(Message.Message, {
|
|
201
180
|
properties: { labels: Filter.contains('investor') },
|
|
202
181
|
}),
|
|
203
|
-
).from(
|
|
204
|
-
queues: [queueDxn],
|
|
205
|
-
}),
|
|
182
|
+
).from(Scope.feed(Obj.getURI(mailboxFeed))),
|
|
206
183
|
jsonSchema: JsonSchema.toJsonSchema(Message.Message),
|
|
207
184
|
});
|
|
208
185
|
const contactsView = ViewModel.make({
|
|
@@ -313,7 +290,7 @@ export const generator = () => ({
|
|
|
313
290
|
'subscription',
|
|
314
291
|
(triggerSpec) =>
|
|
315
292
|
(triggerSpec.query = {
|
|
316
|
-
ast: Query.select(Filter.typename('dxos.
|
|
293
|
+
ast: Query.select(Filter.typename('org.dxos.type.chess')).ast as Obj.Mutable<QueryAST.Query>,
|
|
317
294
|
}),
|
|
318
295
|
'type',
|
|
319
296
|
);
|
|
@@ -609,13 +586,13 @@ export const generator = () => ({
|
|
|
609
586
|
);
|
|
610
587
|
const queueId = canvasModel.createNode(
|
|
611
588
|
createConstant({
|
|
612
|
-
value:
|
|
589
|
+
value: EID.make({ spaceId: space.id, entityId: Key.EntityId.random() }),
|
|
613
590
|
...position({ x: -10, y: 5 }),
|
|
614
591
|
}),
|
|
615
592
|
);
|
|
616
593
|
const converter = canvasModel.createNode(createFunction(position({ x: 0, y: 0 })));
|
|
617
594
|
const view = canvasModel.createNode(createText(position({ x: 12, y: 0 })));
|
|
618
|
-
const queue = canvasModel.createNode(
|
|
595
|
+
const queue = canvasModel.createNode(createFeed(position({ x: 0, y: 12 })));
|
|
619
596
|
|
|
620
597
|
builder
|
|
621
598
|
.createEdge({
|
|
@@ -760,8 +737,8 @@ const createQueueSinkPreset = <SpecType extends Trigger.Kind>(
|
|
|
760
737
|
functionTrigger = triggerShape.functionTrigger!.target!;
|
|
761
738
|
const triggerSpec = functionTrigger.spec;
|
|
762
739
|
invariant(triggerSpec && triggerSpec.kind === triggerKind, 'No trigger spec.');
|
|
763
|
-
Obj.
|
|
764
|
-
initSpec(
|
|
740
|
+
Obj.update(functionTrigger, (functionTrigger) => {
|
|
741
|
+
initSpec(functionTrigger.spec as any);
|
|
765
742
|
});
|
|
766
743
|
});
|
|
767
744
|
|
|
@@ -796,12 +773,12 @@ const setupQueue = (
|
|
|
796
773
|
) => {
|
|
797
774
|
const queueId = canvasModel.createNode(
|
|
798
775
|
createConstant({
|
|
799
|
-
value:
|
|
776
|
+
value: EID.make({ spaceId: space.id, entityId: Key.EntityId.random() }),
|
|
800
777
|
...(args?.idPosition ? rawPosition(args.idPosition) : position({ x: -18, y: 5, width: 8, height: 6 })),
|
|
801
778
|
}),
|
|
802
779
|
);
|
|
803
780
|
const queue = canvasModel.createNode(
|
|
804
|
-
|
|
781
|
+
createFeed(
|
|
805
782
|
args?.queuePosition ? rawPosition(args.queuePosition) : position({ x: -3, y: 3, width: 14, height: 10 }),
|
|
806
783
|
),
|
|
807
784
|
);
|
|
@@ -812,9 +789,9 @@ const setupQueue = (
|
|
|
812
789
|
const attachTrigger = (functionTrigger: Trigger.Trigger | undefined, computeModel: ComputeGraphModel) => {
|
|
813
790
|
invariant(functionTrigger);
|
|
814
791
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT)!;
|
|
815
|
-
Obj.
|
|
816
|
-
|
|
817
|
-
|
|
792
|
+
Obj.update(functionTrigger, (functionTrigger) => {
|
|
793
|
+
functionTrigger.function = Ref.make(computeModel.root);
|
|
794
|
+
functionTrigger.inputNodeId = inputNode.id;
|
|
818
795
|
});
|
|
819
796
|
};
|
|
820
797
|
|
package/src/components/index.ts
CHANGED