@dxos/plugin-search 0.8.3-staging.0fa589b → 0.8.4-main.28f8d3d
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-NZN3MIDZ.mjs → app-graph-builder-D2QQTIIR.mjs} +5 -5
- package/dist/lib/browser/{app-graph-builder-NZN3MIDZ.mjs.map → app-graph-builder-D2QQTIIR.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-VMEXQBHE.mjs → chunk-JVMYGOKS.mjs} +3 -3
- package/dist/lib/browser/{chunk-ARZYMSFF.mjs → chunk-KNS62YL2.mjs} +2 -2
- package/dist/lib/browser/{chunk-SB4WGHS2.mjs → chunk-VKV5ZDB4.mjs} +4 -4
- package/dist/lib/browser/{chunk-SB4WGHS2.mjs.map → chunk-VKV5ZDB4.mjs.map} +2 -2
- package/dist/lib/browser/index.mjs +14 -14
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-RWC63UGI.mjs → intent-resolver-NXFDPFHC.mjs} +5 -5
- package/dist/lib/browser/{intent-resolver-RWC63UGI.mjs.map → intent-resolver-NXFDPFHC.mjs.map} +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-TJYKAIR5.mjs → react-surface-B2XYD6JN.mjs} +118 -292
- package/dist/lib/browser/react-surface-B2XYD6JN.mjs.map +7 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/components/Search.stories.d.ts +1 -1
- 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.d.ts.map +1 -1
- package/dist/types/src/components/SearchResults/SearchResults.stories.d.ts +1 -1
- 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 +1 -1
- 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/src/translations.d.ts +13 -13
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +33 -34
- package/src/SearchPlugin.tsx +3 -3
- 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 +4 -3
- package/src/components/SearchMain.tsx +4 -3
- package/src/components/SearchResults/SearchResults.stories.tsx +3 -2
- package/src/components/SearchResults/SearchResults.tsx +13 -15
- package/src/components/Searchbar/Searchbar.stories.tsx +1 -1
- package/src/components/Searchbar/Searchbar.tsx +3 -5
- package/src/hooks/sync.test.ts +1 -1
- package/src/hooks/sync.ts +1 -1
- package/src/hooks/useGlobalSearch.tsx +3 -2
- package/src/hooks/useWebSearch.ts +3 -8
- package/src/search/exa.test.ts +3 -24
- package/src/search/exa.ts +132 -163
- package/src/translations.ts +6 -4
- package/src/types/index.ts +1 -1
- package/dist/lib/browser/react-surface-TJYKAIR5.mjs.map +0 -7
- /package/dist/lib/browser/{chunk-VMEXQBHE.mjs.map → chunk-JVMYGOKS.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-ARZYMSFF.mjs.map → chunk-KNS62YL2.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-search",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4-main.28f8d3d",
|
|
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,52 +27,50 @@
|
|
|
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.
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/echo": "0.8.
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/echo-schema": "0.8.
|
|
36
|
-
"@dxos/effect": "0.8.
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/invariant": "0.8.
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/plugin-
|
|
42
|
-
"@dxos/plugin-
|
|
43
|
-
"@dxos/plugin-
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/react-
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
30
|
+
"@dxos/ai": "0.8.4-main.28f8d3d",
|
|
31
|
+
"@dxos/app-framework": "0.8.4-main.28f8d3d",
|
|
32
|
+
"@dxos/debug": "0.8.4-main.28f8d3d",
|
|
33
|
+
"@dxos/blueprints": "0.8.4-main.28f8d3d",
|
|
34
|
+
"@dxos/echo": "0.8.4-main.28f8d3d",
|
|
35
|
+
"@dxos/echo-protocol": "0.8.4-main.28f8d3d",
|
|
36
|
+
"@dxos/echo-schema": "0.8.4-main.28f8d3d",
|
|
37
|
+
"@dxos/effect": "0.8.4-main.28f8d3d",
|
|
38
|
+
"@dxos/live-object": "0.8.4-main.28f8d3d",
|
|
39
|
+
"@dxos/invariant": "0.8.4-main.28f8d3d",
|
|
40
|
+
"@dxos/log": "0.8.4-main.28f8d3d",
|
|
41
|
+
"@dxos/assistant": "0.8.4-main.28f8d3d",
|
|
42
|
+
"@dxos/plugin-graph": "0.8.4-main.28f8d3d",
|
|
43
|
+
"@dxos/plugin-client": "0.8.4-main.28f8d3d",
|
|
44
|
+
"@dxos/plugin-deck": "0.8.4-main.28f8d3d",
|
|
45
|
+
"@dxos/plugin-space": "0.8.4-main.28f8d3d",
|
|
46
|
+
"@dxos/react-client": "0.8.4-main.28f8d3d",
|
|
47
|
+
"@dxos/react-ui-searchlist": "0.8.4-main.28f8d3d",
|
|
48
|
+
"@dxos/schema": "0.8.4-main.28f8d3d",
|
|
49
|
+
"@dxos/util": "0.8.4-main.28f8d3d",
|
|
50
|
+
"@dxos/react-ui-stack": "0.8.4-main.28f8d3d"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"@effect-rx/rx-react": "
|
|
53
|
-
"@effect/platform": "0.
|
|
54
|
-
"@phosphor-icons/react": "^2.1.5",
|
|
53
|
+
"@effect-rx/rx-react": "0.38.0",
|
|
54
|
+
"@effect/platform": "0.90.2",
|
|
55
55
|
"@types/react": "~18.2.0",
|
|
56
56
|
"@types/react-dom": "~18.2.0",
|
|
57
|
-
"effect": "3.
|
|
57
|
+
"effect": "3.17.7",
|
|
58
58
|
"react": "~18.2.0",
|
|
59
59
|
"react-dom": "~18.2.0",
|
|
60
60
|
"vite": "5.4.7",
|
|
61
|
-
"@dxos/random": "0.8.
|
|
62
|
-
"@dxos/react-ui": "0.8.
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
61
|
+
"@dxos/random": "0.8.4-main.28f8d3d",
|
|
62
|
+
"@dxos/react-ui": "0.8.4-main.28f8d3d",
|
|
63
|
+
"@dxos/react-ui-theme": "0.8.4-main.28f8d3d",
|
|
64
|
+
"@dxos/storybook-utils": "0.8.4-main.28f8d3d"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"@effect-rx/rx-react": "^0.34.1",
|
|
68
|
-
"@effect/platform": "0.80.12",
|
|
69
|
-
"@phosphor-icons/react": "^2.1.5",
|
|
68
|
+
"@effect/platform": "^0.80.12",
|
|
70
69
|
"effect": "^3.13.3",
|
|
71
70
|
"react": "~18.2.0",
|
|
72
71
|
"react-dom": "~18.2.0",
|
|
73
|
-
"@dxos/react-ui
|
|
74
|
-
"@dxos/react-ui": "0.8.
|
|
72
|
+
"@dxos/react-ui": "0.8.4-main.28f8d3d",
|
|
73
|
+
"@dxos/react-ui-theme": "0.8.4-main.28f8d3d"
|
|
75
74
|
},
|
|
76
75
|
"publishConfig": {
|
|
77
76
|
"access": "public"
|
package/src/SearchPlugin.tsx
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
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 {
|
|
9
|
-
import translations from './translations';
|
|
8
|
+
import { SEARCH_RESULT, meta } from './meta';
|
|
9
|
+
import { translations } from './translations';
|
|
10
10
|
import { type SearchResult } from './types';
|
|
11
11
|
|
|
12
12
|
export const SearchPlugin = () =>
|
|
@@ -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 } 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 & {
|
|
@@ -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,15 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type Meta } from '@storybook/react';
|
|
7
|
+
import { type Meta } 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
19
|
const DefaultStory = (args: SearchResultsProps) => {
|
|
@@ -43,21 +43,19 @@ export const SearchItem = forwardRef<HTMLDivElement, SearchItemProps>((item, for
|
|
|
43
43
|
const { id, objectType, label, snippet, match, selected, onSelect } = item;
|
|
44
44
|
|
|
45
45
|
return (
|
|
46
|
-
<Card.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
</Card.Content>
|
|
60
|
-
</Card.Root>
|
|
46
|
+
<Card.StaticRoot
|
|
47
|
+
ref={forwardRef}
|
|
48
|
+
classNames={['mx-2 mt-2 cursor-pointer', selected && '!bg-activeSurface', ghostHover]}
|
|
49
|
+
onClick={() => onSelect?.(id)}
|
|
50
|
+
>
|
|
51
|
+
{objectType && (
|
|
52
|
+
<>
|
|
53
|
+
<div className='text-xs text-neutral-400 ml-4'>{objectType}</div>
|
|
54
|
+
</>
|
|
55
|
+
)}
|
|
56
|
+
<Card.Heading>{label ?? 'Untitled'}</Card.Heading>
|
|
57
|
+
{snippet && <Snippet text={snippet} match={match} />}
|
|
58
|
+
</Card.StaticRoot>
|
|
61
59
|
);
|
|
62
60
|
});
|
|
63
61
|
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { MagnifyingGlass } from '@phosphor-icons/react';
|
|
6
5
|
import React, { type KeyboardEvent, useEffect, useRef, useState } from 'react';
|
|
7
6
|
|
|
8
|
-
import { Input, type TextInputProps } from '@dxos/react-ui';
|
|
9
|
-
import { getSize, mx } from '@dxos/react-ui-theme';
|
|
7
|
+
import { Icon, Input, type TextInputProps } from '@dxos/react-ui';
|
|
10
8
|
|
|
11
9
|
export type SearchbarProps = Pick<TextInputProps, 'variant' | 'placeholder'> & {
|
|
12
10
|
classes?: {
|
|
@@ -54,14 +52,14 @@ export const Searchbar = ({ classes, variant, placeholder, value, onChange, onSu
|
|
|
54
52
|
placeholder={placeholder}
|
|
55
53
|
variant={variant}
|
|
56
54
|
value={text ?? ''}
|
|
57
|
-
classNames={
|
|
55
|
+
classNames={['pl-3 pr-10', classes?.input]}
|
|
58
56
|
onChange={({ target }) => handleChange(target.value)}
|
|
59
57
|
onKeyDown={handleKeyDown}
|
|
60
58
|
/>
|
|
61
59
|
|
|
62
60
|
{/* TODO(burdon): Margin should be density specific. */}
|
|
63
61
|
<div role='button' className='-ml-7 p-0 cursor-pointer' onClick={handleReset}>
|
|
64
|
-
<
|
|
62
|
+
<Icon icon='ph--magnifying-glass--regular' size={5} />
|
|
65
63
|
</div>
|
|
66
64
|
</Input.Root>
|
|
67
65
|
</div>
|
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';
|
package/src/hooks/sync.ts
CHANGED
|
@@ -63,7 +63,7 @@ export const filterObjectsSync = <T extends Record<string, any>>(objects: T[], m
|
|
|
63
63
|
match,
|
|
64
64
|
// TODO(burdon): Truncate.
|
|
65
65
|
// TODO(burdon): Issue with sketch documents.
|
|
66
|
-
snippet: value !== label ? value : fields.content ?? fields.description ?? undefined,
|
|
66
|
+
snippet: value !== label ? value : (fields.content ?? fields.description ?? undefined),
|
|
67
67
|
object,
|
|
68
68
|
});
|
|
69
69
|
|
|
@@ -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;
|
|
@@ -4,23 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import { useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { AI_SERVICE_ENDPOINT, EXA_API_KEY } from '@dxos/ai/testing';
|
|
7
|
+
import { EXA_API_KEY } from '@dxos/ai/testing';
|
|
9
8
|
import { Obj } from '@dxos/echo';
|
|
10
9
|
import { type DXN } from '@dxos/keys';
|
|
11
10
|
import { log } from '@dxos/log';
|
|
12
11
|
import { getIconAnnotation } from '@dxos/schema';
|
|
13
12
|
import { Testing } from '@dxos/schema/testing';
|
|
14
13
|
|
|
15
|
-
import { getStringProperty } from './sync';
|
|
16
14
|
import { search } from '../search';
|
|
17
15
|
import { type SearchResult } from '../types';
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
const AiService = new EdgeAiServiceClient({
|
|
21
|
-
endpoint: AI_SERVICE_ENDPOINT.REMOTE,
|
|
22
|
-
});
|
|
17
|
+
import { getStringProperty } from './sync';
|
|
23
18
|
|
|
19
|
+
export const useWebSearch = ({ query, context }: { query?: string; context?: string }) => {
|
|
24
20
|
const [results, setResults] = useState<SearchResult[]>([]);
|
|
25
21
|
const [isLoading, setIsLoading] = useState(false);
|
|
26
22
|
|
|
@@ -32,7 +28,6 @@ export const useWebSearch = ({ query, context }: { query?: string; context?: str
|
|
|
32
28
|
query,
|
|
33
29
|
context,
|
|
34
30
|
schema: [Testing.Project, Testing.Organization, Testing.Contact],
|
|
35
|
-
AiService,
|
|
36
31
|
exaApiKey: EXA_API_KEY,
|
|
37
32
|
});
|
|
38
33
|
|
package/src/search/exa.test.ts
CHANGED
|
@@ -4,32 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import { describe, test } from 'vitest';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { AI_SERVICE_ENDPOINT, EXA_API_KEY } from '@dxos/ai/testing';
|
|
7
|
+
import { EXA_API_KEY } from '@dxos/ai/testing';
|
|
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
|
|
|
14
|
-
const REMOTE_AI = true;
|
|
15
|
-
|
|
16
|
-
const AiService = REMOTE_AI
|
|
17
|
-
? new EdgeAiServiceClient({
|
|
18
|
-
endpoint: AI_SERVICE_ENDPOINT.REMOTE,
|
|
19
|
-
})
|
|
20
|
-
: new OllamaAiServiceClient({
|
|
21
|
-
overrides: {
|
|
22
|
-
model: 'llama3.1:8b',
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
|
|
26
14
|
describe.skip('Search', () => {
|
|
27
15
|
describe('Query-based', () => {
|
|
28
16
|
test.skip('contacts', { timeout: 60_000 }, async () => {
|
|
29
17
|
const objects = await search({
|
|
30
18
|
query: 'top executives at google',
|
|
31
19
|
schema: [Testing.Contact],
|
|
32
|
-
AiService,
|
|
33
20
|
exaApiKey: EXA_API_KEY,
|
|
34
21
|
});
|
|
35
22
|
|
|
@@ -40,7 +27,6 @@ describe.skip('Search', () => {
|
|
|
40
27
|
const objects = await search({
|
|
41
28
|
query: 'top executives at google',
|
|
42
29
|
schema: [Testing.Contact, Testing.Project, Testing.Organization],
|
|
43
|
-
AiService,
|
|
44
30
|
exaApiKey: EXA_API_KEY,
|
|
45
31
|
});
|
|
46
32
|
|
|
@@ -51,7 +37,6 @@ describe.skip('Search', () => {
|
|
|
51
37
|
const objects = await search({
|
|
52
38
|
query: 'a19z org, projects they invest in and team',
|
|
53
39
|
schema: [Testing.Project, Testing.Organization, Testing.Contact],
|
|
54
|
-
AiService,
|
|
55
40
|
exaApiKey: EXA_API_KEY,
|
|
56
41
|
});
|
|
57
42
|
|
|
@@ -62,7 +47,6 @@ describe.skip('Search', () => {
|
|
|
62
47
|
const objects = await search({
|
|
63
48
|
query: 'companies building CRDTs',
|
|
64
49
|
schema: [Testing.Project, Testing.Organization, Testing.Contact],
|
|
65
|
-
AiService,
|
|
66
50
|
exaApiKey: EXA_API_KEY,
|
|
67
51
|
});
|
|
68
52
|
|
|
@@ -75,7 +59,6 @@ describe.skip('Search', () => {
|
|
|
75
59
|
const objects = await search({
|
|
76
60
|
context: COMPOSER_DXOS_DOC,
|
|
77
61
|
schema: [Testing.Project, Testing.Organization, Testing.Contact],
|
|
78
|
-
AiService,
|
|
79
62
|
exaApiKey: EXA_API_KEY,
|
|
80
63
|
});
|
|
81
64
|
|
|
@@ -86,7 +69,6 @@ describe.skip('Search', () => {
|
|
|
86
69
|
const objects = await search({
|
|
87
70
|
context: EDGE_ARCHITECTURE_DOC,
|
|
88
71
|
schema: [Testing.Project, Testing.Organization, Testing.Contact],
|
|
89
|
-
AiService,
|
|
90
72
|
exaApiKey: EXA_API_KEY,
|
|
91
73
|
});
|
|
92
74
|
|
|
@@ -96,8 +78,7 @@ describe.skip('Search', () => {
|
|
|
96
78
|
});
|
|
97
79
|
|
|
98
80
|
// TODO(dmaretskyi): Import as txt.
|
|
99
|
-
const COMPOSER_DXOS_DOC = `
|
|
100
|
-
|
|
81
|
+
const COMPOSER_DXOS_DOC = trim`
|
|
101
82
|

|
|
102
83
|
# Welcome to Composer by DXOS
|
|
103
84
|
|
|
@@ -231,6 +212,4 @@ const EDGE_ARCHITECTURE_DOC = `
|
|
|
231
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
|
|
232
213
|
|
|
233
214
|
### Service Side
|
|
234
|
-
|
|
235
|
-
|
|
236
215
|
`;
|