@dxos/plugin-search 0.8.4-main.b97322e → 0.8.4-main.f5c0578
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-VKV5ZDB4.mjs} +1 -1
- package/dist/lib/browser/{chunk-BXSF7IAU.mjs.map → chunk-VKV5ZDB4.mjs.map} +2 -2
- 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-MPPIWDBF.mjs → react-surface-B2XYD6JN.mjs} +88 -271
- 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.map +1 -1
- package/dist/types/src/components/SearchMain.d.ts.map +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/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 +31 -30
- 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 +4 -3
- package/src/components/SearchMain.tsx +4 -3
- package/src/components/SearchResults/SearchResults.stories.tsx +2 -1
- 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/useWebSearch.ts +3 -8
- package/src/search/exa.test.ts +2 -11
- package/src/search/exa.ts +127 -149
- package/dist/lib/browser/react-surface-MPPIWDBF.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.f5c0578",
|
|
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/echo": "0.8.4-main.
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/echo-
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/invariant": "0.8.4-main.
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/plugin-
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/plugin-
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/react-
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
30
|
+
"@dxos/ai": "0.8.4-main.f5c0578",
|
|
31
|
+
"@dxos/app-framework": "0.8.4-main.f5c0578",
|
|
32
|
+
"@dxos/assistant": "0.8.4-main.f5c0578",
|
|
33
|
+
"@dxos/echo": "0.8.4-main.f5c0578",
|
|
34
|
+
"@dxos/echo-protocol": "0.8.4-main.f5c0578",
|
|
35
|
+
"@dxos/debug": "0.8.4-main.f5c0578",
|
|
36
|
+
"@dxos/echo-schema": "0.8.4-main.f5c0578",
|
|
37
|
+
"@dxos/blueprints": "0.8.4-main.f5c0578",
|
|
38
|
+
"@dxos/effect": "0.8.4-main.f5c0578",
|
|
39
|
+
"@dxos/invariant": "0.8.4-main.f5c0578",
|
|
40
|
+
"@dxos/log": "0.8.4-main.f5c0578",
|
|
41
|
+
"@dxos/live-object": "0.8.4-main.f5c0578",
|
|
42
|
+
"@dxos/plugin-client": "0.8.4-main.f5c0578",
|
|
43
|
+
"@dxos/plugin-deck": "0.8.4-main.f5c0578",
|
|
44
|
+
"@dxos/plugin-graph": "0.8.4-main.f5c0578",
|
|
45
|
+
"@dxos/plugin-space": "0.8.4-main.f5c0578",
|
|
46
|
+
"@dxos/react-ui-stack": "0.8.4-main.f5c0578",
|
|
47
|
+
"@dxos/react-client": "0.8.4-main.f5c0578",
|
|
48
|
+
"@dxos/react-ui-searchlist": "0.8.4-main.f5c0578",
|
|
49
|
+
"@dxos/util": "0.8.4-main.f5c0578",
|
|
50
|
+
"@dxos/schema": "0.8.4-main.f5c0578"
|
|
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
60
|
"vite": "5.4.7",
|
|
60
|
-
"@dxos/random": "0.8.4-main.
|
|
61
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
62
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
63
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
61
|
+
"@dxos/random": "0.8.4-main.f5c0578",
|
|
62
|
+
"@dxos/react-ui": "0.8.4-main.f5c0578",
|
|
63
|
+
"@dxos/react-ui-theme": "0.8.4-main.f5c0578",
|
|
64
|
+
"@dxos/storybook-utils": "0.8.4-main.f5c0578"
|
|
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-theme": "0.8.4-main.
|
|
72
|
+
"@dxos/react-ui": "0.8.4-main.f5c0578",
|
|
73
|
+
"@dxos/react-ui-theme": "0.8.4-main.f5c0578"
|
|
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 } 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();
|
|
@@ -10,9 +10,10 @@ import React, { useState } from 'react';
|
|
|
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) => {
|
|
@@ -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;
|
|
@@ -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
|
@@ -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
|
`;
|