@dxos/plugin-search 0.8.4-main.c1de068 → 0.8.4-main.e098934
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/{app-graph-builder-FLW7KDC5.mjs → app-graph-builder-D2QQTIIR.mjs} +2 -2
- package/dist/lib/browser/{app-graph-builder-FLW7KDC5.mjs.map → app-graph-builder-D2QQTIIR.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-BXSF7IAU.mjs → chunk-YJGLEPHU.mjs} +3 -3
- package/dist/lib/browser/{chunk-BXSF7IAU.mjs.map → chunk-YJGLEPHU.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +5 -5
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-JPBGEKFT.mjs → intent-resolver-NXFDPFHC.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-JPBGEKFT.mjs.map → intent-resolver-NXFDPFHC.mjs.map} +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-ETKK5YS3.mjs → react-surface-LNREIVO7.mjs} +86 -266
- package/dist/lib/browser/react-surface-LNREIVO7.mjs.map +7 -0
- 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 +3 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/components/Search.stories.d.ts +15 -10
- package/dist/types/src/components/Search.stories.d.ts.map +1 -1
- package/dist/types/src/components/SearchMain.d.ts.map +1 -1
- package/dist/types/src/components/SearchResults/SearchResults.stories.d.ts +12 -7
- package/dist/types/src/components/SearchResults/SearchResults.stories.d.ts.map +1 -1
- package/dist/types/src/components/Searchbar/Searchbar.d.ts.map +1 -1
- package/dist/types/src/components/Searchbar/Searchbar.stories.d.ts +10 -7
- package/dist/types/src/components/Searchbar/Searchbar.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/useGlobalSearch.d.ts.map +1 -1
- package/dist/types/src/hooks/useWebSearch.d.ts.map +1 -1
- package/dist/types/src/search/exa.d.ts +0 -2
- package/dist/types/src/search/exa.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -31
- package/src/SearchPlugin.tsx +2 -2
- package/src/capabilities/app-graph-builder.ts +2 -2
- package/src/capabilities/intent-resolver.ts +1 -1
- package/src/capabilities/react-surface.tsx +1 -1
- package/src/components/Search.stories.tsx +16 -7
- package/src/components/SearchMain.tsx +4 -3
- package/src/components/SearchResults/SearchResults.stories.tsx +16 -13
- package/src/components/Searchbar/Searchbar.stories.tsx +7 -5
- package/src/components/Searchbar/Searchbar.tsx +1 -1
- package/src/hooks/sync.test.ts +1 -1
- package/src/hooks/useGlobalSearch.tsx +3 -2
- package/src/hooks/useSearchResults.ts +2 -2
- package/src/hooks/useWebSearch.ts +1 -2
- package/src/search/exa.test.ts +2 -11
- package/src/search/exa.ts +127 -149
- package/dist/lib/browser/react-surface-ETKK5YS3.mjs.map +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-search",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.e098934",
|
|
4
4
|
"description": "Braneframe sketch plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
13
14
|
"types": "./dist/types/src/index.d.ts",
|
|
14
15
|
"browser": "./dist/lib/browser/index.mjs"
|
|
15
16
|
}
|
|
@@ -26,41 +27,41 @@
|
|
|
26
27
|
"@preact-signals/safe-react": "^0.9.0",
|
|
27
28
|
"exa-js": "^1.5.12",
|
|
28
29
|
"main-thread-scheduling": "^14.1.1",
|
|
29
|
-
"@dxos/ai": "0.8.4-main.
|
|
30
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
31
|
-
"@dxos/assistant": "0.8.4-main.
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/echo
|
|
35
|
-
"@dxos/echo": "0.8.4-main.
|
|
36
|
-
"@dxos/echo-schema": "0.8.4-main.
|
|
37
|
-
"@dxos/effect": "0.8.4-main.
|
|
38
|
-
"@dxos/invariant": "0.8.4-main.
|
|
39
|
-
"@dxos/log": "0.8.4-main.
|
|
40
|
-
"@dxos/live-object": "0.8.4-main.
|
|
41
|
-
"@dxos/plugin-
|
|
42
|
-
"@dxos/react-client": "0.8.4-main.
|
|
43
|
-
"@dxos/plugin-
|
|
44
|
-
"@dxos/plugin-
|
|
45
|
-
"@dxos/react-ui-
|
|
46
|
-
"@dxos/react-ui-
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
30
|
+
"@dxos/ai": "0.8.4-main.e098934",
|
|
31
|
+
"@dxos/app-framework": "0.8.4-main.e098934",
|
|
32
|
+
"@dxos/assistant": "0.8.4-main.e098934",
|
|
33
|
+
"@dxos/blueprints": "0.8.4-main.e098934",
|
|
34
|
+
"@dxos/debug": "0.8.4-main.e098934",
|
|
35
|
+
"@dxos/echo": "0.8.4-main.e098934",
|
|
36
|
+
"@dxos/echo-protocol": "0.8.4-main.e098934",
|
|
37
|
+
"@dxos/echo-schema": "0.8.4-main.e098934",
|
|
38
|
+
"@dxos/effect": "0.8.4-main.e098934",
|
|
39
|
+
"@dxos/invariant": "0.8.4-main.e098934",
|
|
40
|
+
"@dxos/log": "0.8.4-main.e098934",
|
|
41
|
+
"@dxos/live-object": "0.8.4-main.e098934",
|
|
42
|
+
"@dxos/plugin-deck": "0.8.4-main.e098934",
|
|
43
|
+
"@dxos/react-client": "0.8.4-main.e098934",
|
|
44
|
+
"@dxos/plugin-client": "0.8.4-main.e098934",
|
|
45
|
+
"@dxos/plugin-space": "0.8.4-main.e098934",
|
|
46
|
+
"@dxos/react-ui-stack": "0.8.4-main.e098934",
|
|
47
|
+
"@dxos/react-ui-searchlist": "0.8.4-main.e098934",
|
|
48
|
+
"@dxos/plugin-graph": "0.8.4-main.e098934",
|
|
49
|
+
"@dxos/schema": "0.8.4-main.e098934",
|
|
50
|
+
"@dxos/util": "0.8.4-main.e098934"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@effect-rx/rx-react": "0.38.0",
|
|
53
|
-
"@effect/platform": "0.
|
|
54
|
+
"@effect/platform": "0.90.2",
|
|
54
55
|
"@types/react": "~18.2.0",
|
|
55
56
|
"@types/react-dom": "~18.2.0",
|
|
56
|
-
"effect": "3.17.
|
|
57
|
+
"effect": "3.17.7",
|
|
57
58
|
"react": "~18.2.0",
|
|
58
59
|
"react-dom": "~18.2.0",
|
|
59
|
-
"vite": "
|
|
60
|
-
"@dxos/random": "0.8.4-main.
|
|
61
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
62
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
63
|
-
"@dxos/react-ui
|
|
60
|
+
"vite": "7.1.1",
|
|
61
|
+
"@dxos/random": "0.8.4-main.e098934",
|
|
62
|
+
"@dxos/react-ui-theme": "0.8.4-main.e098934",
|
|
63
|
+
"@dxos/storybook-utils": "0.8.4-main.e098934",
|
|
64
|
+
"@dxos/react-ui": "0.8.4-main.e098934"
|
|
64
65
|
},
|
|
65
66
|
"peerDependencies": {
|
|
66
67
|
"@effect-rx/rx-react": "^0.34.1",
|
|
@@ -68,8 +69,8 @@
|
|
|
68
69
|
"effect": "^3.13.3",
|
|
69
70
|
"react": "~18.2.0",
|
|
70
71
|
"react-dom": "~18.2.0",
|
|
71
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
72
|
-
"@dxos/react-ui
|
|
72
|
+
"@dxos/react-ui-theme": "0.8.4-main.e098934",
|
|
73
|
+
"@dxos/react-ui": "0.8.4-main.e098934"
|
|
73
74
|
},
|
|
74
75
|
"publishConfig": {
|
|
75
76
|
"access": "public"
|
package/src/SearchPlugin.tsx
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Capabilities, Events, contributes, defineModule, definePlugin } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
7
|
import { AppGraphBuilder, IntentResolver, ReactSurface } from './capabilities';
|
|
8
|
-
import {
|
|
8
|
+
import { SEARCH_RESULT, meta } from './meta';
|
|
9
9
|
import { translations } from './translations';
|
|
10
10
|
import { type SearchResult } from './types';
|
|
11
11
|
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import { Rx } from '@effect-rx/rx-react';
|
|
6
6
|
import { Option, pipe } from 'effect';
|
|
7
7
|
|
|
8
|
-
import { Capabilities, contributes, createIntent
|
|
8
|
+
import { Capabilities, type PluginContext, contributes, createIntent } from '@dxos/app-framework';
|
|
9
9
|
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
10
10
|
import { ATTENDABLE_PATH_SEPARATOR, DECK_COMPANION_TYPE } from '@dxos/plugin-deck/types';
|
|
11
|
-
import {
|
|
11
|
+
import { ROOT_ID, createExtension, rxFromSignal } from '@dxos/plugin-graph';
|
|
12
12
|
import { parseId } from '@dxos/react-client/echo';
|
|
13
13
|
|
|
14
14
|
import { SEARCH_PLUGIN } from '../meta';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Capabilities, LayoutAction, contributes, createIntent, createResolver } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
7
|
import { SearchAction } from '../types';
|
|
8
8
|
|
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
8
8
|
import { useActiveSpace } from '@dxos/plugin-space';
|
|
9
|
-
import {
|
|
9
|
+
import { type Space, isSpace } from '@dxos/react-client/echo';
|
|
10
10
|
|
|
11
11
|
import { SEARCH_DIALOG, SearchDialog, type SearchDialogProps, SearchMain } from '../components';
|
|
12
12
|
import { SearchContextProvider } from '../hooks';
|
|
@@ -4,16 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type Decorator, type Meta, type StoryFn, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
import React, { useState } from 'react';
|
|
9
9
|
|
|
10
10
|
import { faker } from '@dxos/random';
|
|
11
11
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
12
12
|
|
|
13
|
-
import { SearchResults } from './SearchResults';
|
|
14
|
-
import { Searchbar, type SearchbarProps } from './Searchbar';
|
|
15
13
|
import { SearchContextProvider, useGlobalSearch, useGlobalSearchResults } from '../hooks';
|
|
16
14
|
|
|
15
|
+
import { Searchbar, type SearchbarProps } from './Searchbar';
|
|
16
|
+
import { SearchResults } from './SearchResults';
|
|
17
|
+
|
|
17
18
|
faker.seed(1);
|
|
18
19
|
|
|
19
20
|
type StoryProps = SearchbarProps & {
|
|
@@ -43,7 +44,7 @@ const SearchContextDecorator = (): Decorator => {
|
|
|
43
44
|
);
|
|
44
45
|
};
|
|
45
46
|
|
|
46
|
-
export const Default = {
|
|
47
|
+
export const Default: Story = {
|
|
47
48
|
args: {
|
|
48
49
|
objects: Array.from({ length: 8 }).map(() => ({
|
|
49
50
|
id: faker.string.uuid(),
|
|
@@ -53,14 +54,22 @@ export const Default = {
|
|
|
53
54
|
},
|
|
54
55
|
};
|
|
55
56
|
|
|
56
|
-
const meta
|
|
57
|
+
const meta = {
|
|
57
58
|
title: 'plugins/plugin-search/Search',
|
|
58
59
|
component: Searchbar,
|
|
59
60
|
render: DefaultStory,
|
|
60
|
-
decorators: [
|
|
61
|
+
decorators: [
|
|
62
|
+
withTheme,
|
|
63
|
+
withLayout({
|
|
64
|
+
fullscreen: true,
|
|
65
|
+
}),
|
|
66
|
+
SearchContextDecorator(),
|
|
67
|
+
],
|
|
61
68
|
parameters: {
|
|
62
69
|
layout: 'fullscreen',
|
|
63
70
|
},
|
|
64
|
-
}
|
|
71
|
+
} satisfies Meta<typeof Searchbar>;
|
|
65
72
|
|
|
66
73
|
export default meta;
|
|
74
|
+
|
|
75
|
+
type Story = StoryObj<typeof meta>;
|
|
@@ -6,16 +6,17 @@ import React, { type FC, useState } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
8
|
import { useClient } from '@dxos/react-client';
|
|
9
|
-
import { Filter,
|
|
9
|
+
import { Filter, type Space, useQuery } from '@dxos/react-client/echo';
|
|
10
10
|
import { type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
11
11
|
import { activeSurface, mx } from '@dxos/react-ui-theme';
|
|
12
12
|
|
|
13
|
-
import { SearchResults } from './SearchResults';
|
|
14
|
-
import { Searchbar } from './Searchbar';
|
|
15
13
|
import { useGlobalSearch, useGlobalSearchResults } from '../hooks';
|
|
16
14
|
import { useWebSearch } from '../hooks/useWebSearch';
|
|
17
15
|
import { SEARCH_PLUGIN } from '../meta';
|
|
18
16
|
|
|
17
|
+
import { Searchbar } from './Searchbar';
|
|
18
|
+
import { SearchResults } from './SearchResults';
|
|
19
|
+
|
|
19
20
|
export const SearchMain: FC<ThemedClassName<{ space: Space }>> = ({ classNames, space }) => {
|
|
20
21
|
const { t } = useTranslation(SEARCH_PLUGIN);
|
|
21
22
|
const client = useClient();
|
|
@@ -4,24 +4,25 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
import React, { useState } from 'react';
|
|
9
9
|
|
|
10
10
|
import { faker } from '@dxos/random';
|
|
11
11
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
12
12
|
|
|
13
|
-
import { SearchResults, type SearchResultsProps } from './SearchResults';
|
|
14
13
|
import { filterObjectsSync } from '../../hooks';
|
|
15
14
|
|
|
15
|
+
import { SearchResults, type SearchResultsProps } from './SearchResults';
|
|
16
|
+
|
|
16
17
|
faker.seed(1);
|
|
17
18
|
|
|
18
|
-
const DefaultStory = (
|
|
19
|
+
const DefaultStory = (props: SearchResultsProps) => {
|
|
19
20
|
const [selected, setSelected] = useState<string>();
|
|
20
21
|
|
|
21
22
|
return (
|
|
22
23
|
<div className='flex grow justify-center overflow-hidden'>
|
|
23
24
|
<div className='flex w-[300px] m-4 overflow-hidden'>
|
|
24
|
-
<SearchResults {...
|
|
25
|
+
<SearchResults {...props} selected={selected} onSelect={setSelected} />
|
|
25
26
|
</div>
|
|
26
27
|
</div>
|
|
27
28
|
);
|
|
@@ -37,14 +38,7 @@ const objects = Array.from({ length: 100 }).map((_, i) => ({
|
|
|
37
38
|
|
|
38
39
|
const match = new RegExp(word, 'i');
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
args: {
|
|
42
|
-
items: filterObjectsSync(objects, match),
|
|
43
|
-
match,
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const meta: Meta<typeof SearchResults> = {
|
|
41
|
+
const meta = {
|
|
48
42
|
title: 'plugins/plugin-search/SearchResults',
|
|
49
43
|
component: SearchResults,
|
|
50
44
|
render: DefaultStory,
|
|
@@ -52,6 +46,15 @@ const meta: Meta<typeof SearchResults> = {
|
|
|
52
46
|
parameters: {
|
|
53
47
|
layout: 'fullscreen',
|
|
54
48
|
},
|
|
55
|
-
}
|
|
49
|
+
} satisfies Meta<typeof SearchResults>;
|
|
56
50
|
|
|
57
51
|
export default meta;
|
|
52
|
+
|
|
53
|
+
type Story = StoryObj<typeof meta>;
|
|
54
|
+
|
|
55
|
+
export const Default: Story = {
|
|
56
|
+
args: {
|
|
57
|
+
items: filterObjectsSync(objects, match),
|
|
58
|
+
match,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
@@ -4,24 +4,26 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
|
|
9
9
|
import { withTheme } from '@dxos/storybook-utils';
|
|
10
10
|
|
|
11
|
-
import { Searchbar
|
|
11
|
+
import { Searchbar } from './Searchbar';
|
|
12
12
|
|
|
13
|
-
const meta
|
|
13
|
+
const meta = {
|
|
14
14
|
title: 'plugins/plugin-search/Searchbar',
|
|
15
15
|
component: Searchbar,
|
|
16
16
|
decorators: [withTheme],
|
|
17
17
|
parameters: {
|
|
18
18
|
layout: 'centered',
|
|
19
19
|
},
|
|
20
|
-
}
|
|
20
|
+
} satisfies Meta<typeof Searchbar>;
|
|
21
21
|
|
|
22
22
|
export default meta;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
type Story = StoryObj<typeof meta>;
|
|
25
|
+
|
|
26
|
+
export const Default: Story = {
|
|
25
27
|
args: {
|
|
26
28
|
placeholder: 'Search...',
|
|
27
29
|
},
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { type KeyboardEvent, useEffect, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Input, type TextInputProps
|
|
7
|
+
import { Icon, Input, type TextInputProps } from '@dxos/react-ui';
|
|
8
8
|
|
|
9
9
|
export type SearchbarProps = Pick<TextInputProps, 'variant' | 'placeholder'> & {
|
|
10
10
|
classes?: {
|
package/src/hooks/sync.test.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { Client } from '@dxos/client';
|
|
8
|
-
import {
|
|
8
|
+
import { Filter, Obj, Type } from '@dxos/echo';
|
|
9
9
|
import { faker } from '@dxos/random';
|
|
10
10
|
|
|
11
11
|
import { filterObjectsSync } from './sync';
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { type PropsWithChildren, createContext, useContext, useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { raise } from '@dxos/debug';
|
|
8
8
|
|
|
9
|
-
import { filterObjectsSync, queryStringToMatch } from './sync';
|
|
10
9
|
import { type SearchResult } from '../types';
|
|
11
10
|
|
|
11
|
+
import { filterObjectsSync, queryStringToMatch } from './sync';
|
|
12
|
+
|
|
12
13
|
type SearchContextType = {
|
|
13
14
|
match?: RegExp;
|
|
14
15
|
setMatch?: (text?: string) => void;
|
|
@@ -47,14 +47,14 @@ export const useSearchResults = <T extends Record<string, any>>(
|
|
|
47
47
|
|
|
48
48
|
useEffect(() => {
|
|
49
49
|
setPending(!!(objects && queryString));
|
|
50
|
-
const
|
|
50
|
+
const timeout = setTimeout(async () => {
|
|
51
51
|
const nextResults =
|
|
52
52
|
objects && queryString ? await filterObjects(objects, queryStringToMatch(queryString)) : new Map();
|
|
53
53
|
setResults(nextResults);
|
|
54
54
|
setPending(false);
|
|
55
55
|
}, delay);
|
|
56
56
|
|
|
57
|
-
return () => clearTimeout(
|
|
57
|
+
return () => clearTimeout(timeout);
|
|
58
58
|
}, [queryString, objects]);
|
|
59
59
|
|
|
60
60
|
return [pending, results];
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import { useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { EXA_API_KEY } from '@dxos/ai/testing';
|
|
8
|
-
import { todo } from '@dxos/debug';
|
|
9
8
|
import { Obj } from '@dxos/echo';
|
|
10
9
|
import { type DXN } from '@dxos/keys';
|
|
11
10
|
import { log } from '@dxos/log';
|
|
@@ -14,6 +13,7 @@ import { Testing } from '@dxos/schema/testing';
|
|
|
14
13
|
|
|
15
14
|
import { search } from '../search';
|
|
16
15
|
import { type SearchResult } from '../types';
|
|
16
|
+
|
|
17
17
|
import { getStringProperty } from './sync';
|
|
18
18
|
|
|
19
19
|
export const useWebSearch = ({ query, context }: { query?: string; context?: string }) => {
|
|
@@ -28,7 +28,6 @@ export const useWebSearch = ({ query, context }: { query?: string; context?: str
|
|
|
28
28
|
query,
|
|
29
29
|
context,
|
|
30
30
|
schema: [Testing.Project, Testing.Organization, Testing.Contact],
|
|
31
|
-
AiService: todo(),
|
|
32
31
|
exaApiKey: EXA_API_KEY,
|
|
33
32
|
});
|
|
34
33
|
|
package/src/search/exa.test.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import { describe, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { EXA_API_KEY } from '@dxos/ai/testing';
|
|
8
|
-
import { todo } from '@dxos/debug';
|
|
9
8
|
import { log } from '@dxos/log';
|
|
10
9
|
import { Testing } from '@dxos/schema/testing';
|
|
10
|
+
import { trim } from '@dxos/util';
|
|
11
11
|
|
|
12
12
|
import { search } from './exa';
|
|
13
13
|
|
|
@@ -17,7 +17,6 @@ describe.skip('Search', () => {
|
|
|
17
17
|
const objects = await search({
|
|
18
18
|
query: 'top executives at google',
|
|
19
19
|
schema: [Testing.Contact],
|
|
20
|
-
AiService: null as any, // TODO: Implement AiService
|
|
21
20
|
exaApiKey: EXA_API_KEY,
|
|
22
21
|
});
|
|
23
22
|
|
|
@@ -28,7 +27,6 @@ describe.skip('Search', () => {
|
|
|
28
27
|
const objects = await search({
|
|
29
28
|
query: 'top executives at google',
|
|
30
29
|
schema: [Testing.Contact, Testing.Project, Testing.Organization],
|
|
31
|
-
AiService: todo(),
|
|
32
30
|
exaApiKey: EXA_API_KEY,
|
|
33
31
|
});
|
|
34
32
|
|
|
@@ -39,7 +37,6 @@ describe.skip('Search', () => {
|
|
|
39
37
|
const objects = await search({
|
|
40
38
|
query: 'a19z org, projects they invest in and team',
|
|
41
39
|
schema: [Testing.Project, Testing.Organization, Testing.Contact],
|
|
42
|
-
AiService: todo(),
|
|
43
40
|
exaApiKey: EXA_API_KEY,
|
|
44
41
|
});
|
|
45
42
|
|
|
@@ -50,7 +47,6 @@ describe.skip('Search', () => {
|
|
|
50
47
|
const objects = await search({
|
|
51
48
|
query: 'companies building CRDTs',
|
|
52
49
|
schema: [Testing.Project, Testing.Organization, Testing.Contact],
|
|
53
|
-
AiService: todo(),
|
|
54
50
|
exaApiKey: EXA_API_KEY,
|
|
55
51
|
});
|
|
56
52
|
|
|
@@ -63,7 +59,6 @@ describe.skip('Search', () => {
|
|
|
63
59
|
const objects = await search({
|
|
64
60
|
context: COMPOSER_DXOS_DOC,
|
|
65
61
|
schema: [Testing.Project, Testing.Organization, Testing.Contact],
|
|
66
|
-
AiService: todo(),
|
|
67
62
|
exaApiKey: EXA_API_KEY,
|
|
68
63
|
});
|
|
69
64
|
|
|
@@ -74,7 +69,6 @@ describe.skip('Search', () => {
|
|
|
74
69
|
const objects = await search({
|
|
75
70
|
context: EDGE_ARCHITECTURE_DOC,
|
|
76
71
|
schema: [Testing.Project, Testing.Organization, Testing.Contact],
|
|
77
|
-
AiService: todo(),
|
|
78
72
|
exaApiKey: EXA_API_KEY,
|
|
79
73
|
});
|
|
80
74
|
|
|
@@ -84,8 +78,7 @@ describe.skip('Search', () => {
|
|
|
84
78
|
});
|
|
85
79
|
|
|
86
80
|
// TODO(dmaretskyi): Import as txt.
|
|
87
|
-
const COMPOSER_DXOS_DOC = `
|
|
88
|
-
|
|
81
|
+
const COMPOSER_DXOS_DOC = trim`
|
|
89
82
|

|
|
90
83
|
# Welcome to Composer by DXOS
|
|
91
84
|
|
|
@@ -219,6 +212,4 @@ const EDGE_ARCHITECTURE_DOC = `
|
|
|
219
212
|
- given the fq id of the deployment object, anyone in the space should be able to invoke the function even if they don't have access to the object itself
|
|
220
213
|
|
|
221
214
|
### Service Side
|
|
222
|
-
|
|
223
|
-
|
|
224
215
|
`;
|