@dxos/plugin-search 0.8.4-main.f9ba587 → 0.8.4-main.fcc0d83b33

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.
Files changed (158) hide show
  1. package/README.md +0 -1
  2. package/dist/lib/browser/index.mjs +309 -89
  3. package/dist/lib/browser/index.mjs.map +4 -4
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/translations.mjs +23 -0
  6. package/dist/lib/browser/translations.mjs.map +7 -0
  7. package/dist/types/src/SearchPlugin.d.ts +2 -1
  8. package/dist/types/src/SearchPlugin.d.ts.map +1 -1
  9. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  10. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  11. package/dist/types/src/capabilities/index.d.ts +5 -3
  12. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  13. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  14. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  15. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  16. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  17. package/dist/types/src/components/SearchResultStack/SearchResultStack.d.ts +9 -0
  18. package/dist/types/src/components/SearchResultStack/SearchResultStack.d.ts.map +1 -0
  19. package/dist/types/src/components/SearchResultStack/index.d.ts +2 -0
  20. package/dist/types/src/components/SearchResultStack/index.d.ts.map +1 -0
  21. package/dist/types/src/components/index.d.ts +1 -3
  22. package/dist/types/src/components/index.d.ts.map +1 -1
  23. package/dist/types/src/constants.d.ts +2 -0
  24. package/dist/types/src/constants.d.ts.map +1 -0
  25. package/dist/types/src/containers/SearchArticle/SearchArticle.d.ts +4 -0
  26. package/dist/types/src/containers/SearchArticle/SearchArticle.d.ts.map +1 -0
  27. package/dist/types/src/containers/SearchArticle/SearchArticle.stories.d.ts +14 -0
  28. package/dist/types/src/containers/SearchArticle/SearchArticle.stories.d.ts.map +1 -0
  29. package/dist/types/src/containers/SearchArticle/index.d.ts +2 -0
  30. package/dist/types/src/containers/SearchArticle/index.d.ts.map +1 -0
  31. package/dist/types/src/containers/SearchDialog/SearchDialog.d.ts +7 -0
  32. package/dist/types/src/containers/SearchDialog/SearchDialog.d.ts.map +1 -0
  33. package/dist/types/src/containers/SearchDialog/SearchDialog.stories.d.ts +16 -0
  34. package/dist/types/src/containers/SearchDialog/SearchDialog.stories.d.ts.map +1 -0
  35. package/dist/types/src/containers/SearchDialog/index.d.ts +2 -0
  36. package/dist/types/src/containers/SearchDialog/index.d.ts.map +1 -0
  37. package/dist/types/src/containers/index.d.ts +4 -0
  38. package/dist/types/src/containers/index.d.ts.map +1 -0
  39. package/dist/types/src/hooks/index.d.ts +1 -0
  40. package/dist/types/src/hooks/index.d.ts.map +1 -1
  41. package/dist/types/src/hooks/sync.d.ts +4 -3
  42. package/dist/types/src/hooks/sync.d.ts.map +1 -1
  43. package/dist/types/src/hooks/useGlobalSearch.d.ts +8 -4
  44. package/dist/types/src/hooks/useGlobalSearch.d.ts.map +1 -1
  45. package/dist/types/src/hooks/useSearchResults.d.ts +3 -2
  46. package/dist/types/src/hooks/useSearchResults.d.ts.map +1 -1
  47. package/dist/types/src/hooks/useWebSearch.d.ts +7 -4
  48. package/dist/types/src/hooks/useWebSearch.d.ts.map +1 -1
  49. package/dist/types/src/meta.d.ts +3 -4
  50. package/dist/types/src/meta.d.ts.map +1 -1
  51. package/dist/types/src/operations/definitions.d.ts +3 -0
  52. package/dist/types/src/operations/definitions.d.ts.map +1 -0
  53. package/dist/types/src/operations/index.d.ts +4 -0
  54. package/dist/types/src/operations/index.d.ts.map +1 -0
  55. package/dist/types/src/operations/open-search.d.ts +5 -0
  56. package/dist/types/src/operations/open-search.d.ts.map +1 -0
  57. package/dist/types/src/search/exa.d.ts +4 -4
  58. package/dist/types/src/search/exa.d.ts.map +1 -1
  59. package/dist/types/src/translations.d.ts +15 -10
  60. package/dist/types/src/translations.d.ts.map +1 -1
  61. package/dist/types/src/types/index.d.ts +1 -2
  62. package/dist/types/src/types/index.d.ts.map +1 -1
  63. package/dist/types/src/types/search.d.ts +1 -20
  64. package/dist/types/src/types/search.d.ts.map +1 -1
  65. package/dist/types/tsconfig.tsbuildinfo +1 -1
  66. package/package.json +73 -49
  67. package/src/SearchPlugin.tsx +30 -48
  68. package/src/capabilities/app-graph-builder.ts +56 -69
  69. package/src/capabilities/index.ts +8 -4
  70. package/src/capabilities/operation-handler.ts +16 -0
  71. package/src/capabilities/react-surface.tsx +68 -55
  72. package/src/components/SearchResultStack/SearchResultStack.tsx +118 -0
  73. package/src/components/SearchResultStack/index.ts +5 -0
  74. package/src/components/index.ts +1 -3
  75. package/src/constants.ts +7 -0
  76. package/src/containers/SearchArticle/SearchArticle.stories.tsx +79 -0
  77. package/src/containers/SearchArticle/SearchArticle.tsx +60 -0
  78. package/src/containers/SearchArticle/index.ts +5 -0
  79. package/src/containers/SearchDialog/SearchDialog.stories.tsx +108 -0
  80. package/src/containers/SearchDialog/SearchDialog.tsx +93 -0
  81. package/src/containers/SearchDialog/index.ts +5 -0
  82. package/src/containers/index.ts +8 -0
  83. package/src/hooks/index.ts +2 -0
  84. package/src/hooks/sync.test.ts +9 -7
  85. package/src/hooks/sync.ts +28 -32
  86. package/src/hooks/useGlobalSearch.tsx +33 -13
  87. package/src/hooks/useSearchResults.ts +9 -6
  88. package/src/hooks/useWebSearch.ts +25 -19
  89. package/src/meta.ts +10 -7
  90. package/src/operations/definitions.ts +17 -0
  91. package/src/operations/index.ts +9 -0
  92. package/src/operations/open-search.ts +24 -0
  93. package/src/search/exa.test.ts +9 -32
  94. package/src/search/exa.ts +140 -168
  95. package/src/translations.ts +10 -9
  96. package/src/types/command-score.d.ts +16 -0
  97. package/src/types/index.ts +1 -2
  98. package/src/types/search.ts +1 -25
  99. package/dist/lib/browser/app-graph-builder-V667YGDS.mjs +0 -77
  100. package/dist/lib/browser/app-graph-builder-V667YGDS.mjs.map +0 -7
  101. package/dist/lib/browser/chunk-2QKDUXCH.mjs +0 -21
  102. package/dist/lib/browser/chunk-2QKDUXCH.mjs.map +0 -7
  103. package/dist/lib/browser/chunk-KNS62YL2.mjs +0 -20
  104. package/dist/lib/browser/chunk-KNS62YL2.mjs.map +0 -7
  105. package/dist/lib/browser/chunk-LPB2XRYL.mjs +0 -190
  106. package/dist/lib/browser/chunk-LPB2XRYL.mjs.map +0 -7
  107. package/dist/lib/browser/intent-resolver-SPX5JVY7.mjs +0 -22
  108. package/dist/lib/browser/intent-resolver-SPX5JVY7.mjs.map +0 -7
  109. package/dist/lib/browser/react-surface-HMXHJSLE.mjs +0 -642
  110. package/dist/lib/browser/react-surface-HMXHJSLE.mjs.map +0 -7
  111. package/dist/lib/node-esm/app-graph-builder-IZHM72QQ.mjs +0 -78
  112. package/dist/lib/node-esm/app-graph-builder-IZHM72QQ.mjs.map +0 -7
  113. package/dist/lib/node-esm/chunk-L7BUHKLC.mjs +0 -192
  114. package/dist/lib/node-esm/chunk-L7BUHKLC.mjs.map +0 -7
  115. package/dist/lib/node-esm/chunk-N5SNYFMK.mjs +0 -22
  116. package/dist/lib/node-esm/chunk-N5SNYFMK.mjs.map +0 -7
  117. package/dist/lib/node-esm/chunk-Y7BGRQH5.mjs +0 -22
  118. package/dist/lib/node-esm/chunk-Y7BGRQH5.mjs.map +0 -7
  119. package/dist/lib/node-esm/index.mjs +0 -113
  120. package/dist/lib/node-esm/index.mjs.map +0 -7
  121. package/dist/lib/node-esm/intent-resolver-MFPFD3XC.mjs +0 -23
  122. package/dist/lib/node-esm/intent-resolver-MFPFD3XC.mjs.map +0 -7
  123. package/dist/lib/node-esm/meta.json +0 -1
  124. package/dist/lib/node-esm/react-surface-WHU5EEAQ.mjs +0 -643
  125. package/dist/lib/node-esm/react-surface-WHU5EEAQ.mjs.map +0 -7
  126. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  127. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  128. package/dist/types/src/components/Search.stories.d.ts +0 -15
  129. package/dist/types/src/components/Search.stories.d.ts.map +0 -1
  130. package/dist/types/src/components/SearchDialog.d.ts +0 -7
  131. package/dist/types/src/components/SearchDialog.d.ts.map +0 -1
  132. package/dist/types/src/components/SearchMain.d.ts +0 -7
  133. package/dist/types/src/components/SearchMain.d.ts.map +0 -1
  134. package/dist/types/src/components/SearchResults/SearchResults.d.ts +0 -20
  135. package/dist/types/src/components/SearchResults/SearchResults.d.ts.map +0 -1
  136. package/dist/types/src/components/SearchResults/SearchResults.stories.d.ts +0 -12
  137. package/dist/types/src/components/SearchResults/SearchResults.stories.d.ts.map +0 -1
  138. package/dist/types/src/components/SearchResults/index.d.ts +0 -2
  139. package/dist/types/src/components/SearchResults/index.d.ts.map +0 -1
  140. package/dist/types/src/components/Searchbar/Searchbar.d.ts +0 -14
  141. package/dist/types/src/components/Searchbar/Searchbar.d.ts.map +0 -1
  142. package/dist/types/src/components/Searchbar/Searchbar.stories.d.ts +0 -11
  143. package/dist/types/src/components/Searchbar/Searchbar.stories.d.ts.map +0 -1
  144. package/dist/types/src/components/Searchbar/index.d.ts +0 -2
  145. package/dist/types/src/components/Searchbar/index.d.ts.map +0 -1
  146. package/dist/types/src/types/action.d.ts +0 -13
  147. package/dist/types/src/types/action.d.ts.map +0 -1
  148. package/src/capabilities/intent-resolver.ts +0 -18
  149. package/src/components/Search.stories.tsx +0 -66
  150. package/src/components/SearchDialog.tsx +0 -124
  151. package/src/components/SearchMain.tsx +0 -67
  152. package/src/components/SearchResults/SearchResults.stories.tsx +0 -57
  153. package/src/components/SearchResults/SearchResults.tsx +0 -86
  154. package/src/components/SearchResults/index.ts +0 -5
  155. package/src/components/Searchbar/Searchbar.stories.tsx +0 -28
  156. package/src/components/Searchbar/Searchbar.tsx +0 -69
  157. package/src/components/Searchbar/index.ts +0 -5
  158. package/src/types/action.tsx +0 -16
@@ -2,12 +2,18 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import React, { createContext, type PropsWithChildren, useContext, useMemo, useState } from 'react';
5
+ import React, { type PropsWithChildren, createContext, useCallback, useContext, useState } from 'react';
6
6
 
7
7
  import { raise } from '@dxos/debug';
8
+ import { type Entity } from '@dxos/echo';
9
+ import { GlobalFilterProvider } from '@dxos/react-ui-search';
10
+
11
+ import { type SearchResult } from '#types';
8
12
 
9
13
  import { filterObjectsSync, queryStringToMatch } from './sync';
10
- import { type SearchResult } from '../types';
14
+
15
+ // Re-export for backward compatibility.
16
+ export { useGlobalFilteredObjects, GlobalFilterProvider } from '@dxos/react-ui-search';
11
17
 
12
18
  type SearchContextType = {
13
19
  match?: RegExp;
@@ -16,26 +22,40 @@ type SearchContextType = {
16
22
 
17
23
  const SearchContext = createContext<SearchContextType>({});
18
24
 
25
+ /**
26
+ * Provider for global search context.
27
+ * Also provides the GlobalFilterProvider for useGlobalFilteredObjects to work.
28
+ */
19
29
  export const SearchContextProvider = ({ children }: PropsWithChildren) => {
20
30
  const [match, setMatch] = useState<RegExp>();
21
31
  const handleMatch = (text?: string) => setMatch(queryStringToMatch(text));
22
- return <SearchContext.Provider value={{ match, setMatch: handleMatch }}>{children}</SearchContext.Provider>;
32
+
33
+ // Provide a filter function for useGlobalFilteredObjects.
34
+ const filterFn = useCallback(
35
+ <T extends Entity.Any>(objects: T[]): T[] => {
36
+ if (!match) {
37
+ return objects;
38
+ }
39
+
40
+ return filterObjectsSync(objects, match)
41
+ .filter((result) => result.object)
42
+ .map((result) => result.object!);
43
+ },
44
+ [match],
45
+ );
46
+
47
+ return (
48
+ <SearchContext.Provider value={{ match, setMatch: handleMatch }}>
49
+ <GlobalFilterProvider filter={filterFn}>{children}</GlobalFilterProvider>
50
+ </SearchContext.Provider>
51
+ );
23
52
  };
24
53
 
25
54
  export const useGlobalSearch = () => {
26
55
  return useContext(SearchContext) ?? raise(new Error('Missing SearchContext.'));
27
56
  };
28
57
 
29
- export const useGlobalSearchResults = <T extends Record<string, any>>(objects?: T[]): SearchResult[] => {
58
+ export const useGlobalSearchResults = <T extends Entity.Unknown>(objects?: T[]): SearchResult<T>[] => {
30
59
  const { match } = useGlobalSearch();
31
60
  return objects && match ? filterObjectsSync(objects, match) : [];
32
61
  };
33
-
34
- export const useGlobalFilteredObjects = <T extends Record<string, any>>(objects?: T[]): T[] => {
35
- const { match } = useGlobalSearch();
36
- if (!match || !objects) {
37
- return objects ?? [];
38
- }
39
-
40
- return useMemo(() => filterObjectsSync(objects, match).map((result) => result.object), [objects, match]);
41
- };
@@ -5,12 +5,13 @@
5
5
  import { yieldOrContinue } from 'main-thread-scheduling';
6
6
  import { useEffect, useState } from 'react';
7
7
 
8
- import { DataType } from '@dxos/schema';
8
+ import { type Entity } from '@dxos/echo';
9
+ import { Text } from '@dxos/schema';
9
10
 
10
11
  // TODO(thure): Deprecate search-sync, move still-relevant utilities elsewhere (here, probably).
11
12
  import { mapObjectToTextFields, queryStringToMatch } from './sync';
12
13
 
13
- export const filterObjects = async <T extends Record<string, any>>(
14
+ export const filterObjects = async <T extends Entity.Unknown>(
14
15
  objects: T[],
15
16
  match?: RegExp,
16
17
  ): Promise<Map<T, string[][]>> => {
@@ -18,9 +19,10 @@ export const filterObjects = async <T extends Record<string, any>>(
18
19
  if (!match) {
19
20
  return result;
20
21
  }
22
+
21
23
  await Promise.all(
22
24
  objects
23
- .filter((object) => !(object instanceof DataType.Text))
25
+ .filter((object) => !(object instanceof Text.Text))
24
26
  .map(async (object) => {
25
27
  await yieldOrContinue('interactive');
26
28
  const fields = mapObjectToTextFields<T>(object);
@@ -34,10 +36,11 @@ export const filterObjects = async <T extends Record<string, any>>(
34
36
  });
35
37
  }),
36
38
  );
39
+
37
40
  return result;
38
41
  };
39
42
 
40
- export const useSearchResults = <T extends Record<string, any>>(
43
+ export const useSearchResults = <T extends Entity.Unknown>(
41
44
  queryString?: string,
42
45
  objects?: T[],
43
46
  delay: number = 400,
@@ -47,14 +50,14 @@ export const useSearchResults = <T extends Record<string, any>>(
47
50
 
48
51
  useEffect(() => {
49
52
  setPending(!!(objects && queryString));
50
- const timeoutId = setTimeout(async () => {
53
+ const timeout = setTimeout(async () => {
51
54
  const nextResults =
52
55
  objects && queryString ? await filterObjects(objects, queryStringToMatch(queryString)) : new Map();
53
56
  setResults(nextResults);
54
57
  setPending(false);
55
58
  }, delay);
56
59
 
57
- return () => clearTimeout(timeoutId);
60
+ return () => clearTimeout(timeout);
58
61
  }, [queryString, objects]);
59
62
 
60
63
  return [pending, results];
@@ -2,45 +2,51 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { useState } from 'react';
5
+ import { useCallback, useState } from 'react';
6
6
 
7
- import { EdgeAiServiceClient } from '@dxos/ai';
8
- import { AI_SERVICE_ENDPOINT, EXA_API_KEY } from '@dxos/ai/testing';
9
- import { Obj } from '@dxos/echo';
10
- import { type DXN } from '@dxos/keys';
7
+ import { EXA_API_KEY } from '@dxos/ai/testing';
8
+ import { Entity } from '@dxos/echo';
11
9
  import { log } from '@dxos/log';
12
10
  import { getIconAnnotation } from '@dxos/schema';
13
- import { Testing } from '@dxos/schema/testing';
11
+ import { TestSchema } from '@dxos/schema/testing';
12
+
13
+ import { type SearchResult } from '#types';
14
14
 
15
- import { getStringProperty } from './sync';
16
15
  import { search } from '../search';
17
- import { type SearchResult } from '../types';
16
+ import { getStringProperty } from './sync';
18
17
 
19
- export const useWebSearch = ({ query, context }: { query?: string; context?: string }) => {
20
- const AiService = new EdgeAiServiceClient({
21
- endpoint: AI_SERVICE_ENDPOINT.REMOTE,
22
- });
18
+ export type UseWebSearchProps = {
19
+ query?: string;
20
+ context?: string;
21
+ };
22
+
23
+ export type UseWebSearch = {
24
+ update: () => Promise<void>;
25
+ results: SearchResult[];
26
+ isLoading: boolean;
27
+ };
23
28
 
29
+ /** @deprecated */
30
+ // TODO(burdon): Remove testing deps.
31
+ export const useWebSearch = ({ query, context }: UseWebSearchProps): UseWebSearch => {
24
32
  const [results, setResults] = useState<SearchResult[]>([]);
25
33
  const [isLoading, setIsLoading] = useState(false);
26
34
 
27
- const runSearch = async () => {
35
+ const update = useCallback(async () => {
28
36
  try {
29
37
  setIsLoading(true);
30
38
  log.info('Running web search', { query, context });
31
39
  const results = await search({
32
40
  query,
33
41
  context,
34
- schema: [Testing.Project, Testing.Organization, Testing.Contact],
35
- AiService,
42
+ schema: [TestSchema.Person, TestSchema.Project, TestSchema.Organization], // TODO(burdon): ???
36
43
  exaApiKey: EXA_API_KEY,
37
44
  });
38
45
 
39
46
  const mappedResults = results.data.map((result): SearchResult => {
40
- const schema = Obj.getSchema(result);
47
+ const schema = Entity.getSchema(result);
41
48
  return {
42
49
  id: result.id,
43
- objectType: Obj.getTypename(result) as DXN.String | undefined,
44
50
  label: getStringProperty(result, ['name', 'title', 'label']),
45
51
  snippet: getStringProperty(result, ['description', 'content', 'website', 'email']),
46
52
  object: result,
@@ -52,7 +58,7 @@ export const useWebSearch = ({ query, context }: { query?: string; context?: str
52
58
  } finally {
53
59
  setIsLoading(false);
54
60
  }
55
- };
61
+ }, [query, context]);
56
62
 
57
- return { runSearch, results, isLoading };
63
+ return { update, results, isLoading };
58
64
  };
package/src/meta.ts CHANGED
@@ -2,16 +2,19 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type PluginMeta } from '@dxos/app-framework';
5
+ import { type Plugin } from '@dxos/app-framework';
6
+ import { trim } from '@dxos/util';
6
7
 
7
- export const SEARCH_PLUGIN = 'dxos.org/plugin/search';
8
- export const SEARCH_RESULT = `${SEARCH_PLUGIN}/result`;
9
-
10
- export const meta: PluginMeta = {
11
- id: SEARCH_PLUGIN,
8
+ export const meta: Plugin.Meta = {
9
+ id: 'org.dxos.plugin.search',
12
10
  name: 'Search',
13
- description: 'Search ECHO spaces for content.',
11
+ description: trim`
12
+ Full-text search engine for finding content across all spaces and object types.
13
+ Quickly locate documents, tables, and other objects with instant results and relevance ranking.
14
+ `,
14
15
  icon: 'ph--magnifying-glass--regular',
15
16
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-search',
16
17
  tags: ['labs'],
17
18
  };
19
+
20
+ export const SEARCH_RESULT = `${meta.id}.result`;
@@ -0,0 +1,17 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Schema from 'effect/Schema';
6
+
7
+ import { Operation } from '@dxos/compute';
8
+
9
+ import { meta } from '#meta';
10
+
11
+ const SEARCH_OPERATION = `${meta.id}.operation`;
12
+
13
+ export const OpenSearch = Operation.make({
14
+ meta: { key: `${SEARCH_OPERATION}.open-search`, name: 'Open Search' },
15
+ input: Schema.Void,
16
+ output: Schema.Void,
17
+ });
@@ -0,0 +1,9 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { OperationHandlerSet } from '@dxos/compute';
6
+
7
+ export * as SearchOperation from './definitions';
8
+
9
+ export const SearchOperationHandlerSet = OperationHandlerSet.lazy(() => import('./open-search'));
@@ -0,0 +1,24 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { LayoutOperation } from '@dxos/app-toolkit';
8
+ import { Operation } from '@dxos/compute';
9
+
10
+ import { SEARCH_DIALOG } from '../constants';
11
+ import { OpenSearch } from './definitions';
12
+
13
+ const handler: Operation.WithHandler<typeof OpenSearch> = OpenSearch.pipe(
14
+ Operation.withHandler(
15
+ Effect.fnUntraced(function* () {
16
+ yield* Operation.invoke(LayoutOperation.UpdateDialog, {
17
+ subject: SEARCH_DIALOG,
18
+ blockAlign: 'start',
19
+ });
20
+ }),
21
+ ),
22
+ );
23
+
24
+ export default handler;
@@ -4,32 +4,18 @@
4
4
 
5
5
  import { describe, test } from 'vitest';
6
6
 
7
- import { EdgeAiServiceClient, OllamaAiServiceClient } from '@dxos/ai';
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
- import { Testing } from '@dxos/schema/testing';
9
+ import { TestSchema } from '@dxos/schema/testing';
11
10
 
12
11
  import { search } from './exa';
13
12
 
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
13
  describe.skip('Search', () => {
27
14
  describe('Query-based', () => {
28
15
  test.skip('contacts', { timeout: 60_000 }, async () => {
29
16
  const objects = await search({
30
17
  query: 'top executives at google',
31
- schema: [Testing.Contact],
32
- AiService,
18
+ schema: [TestSchema.Person],
33
19
  exaApiKey: EXA_API_KEY,
34
20
  });
35
21
 
@@ -39,8 +25,7 @@ describe.skip('Search', () => {
39
25
  test.skip('contacts projects and orgs', { timeout: 60_000 }, async () => {
40
26
  const objects = await search({
41
27
  query: 'top executives at google',
42
- schema: [Testing.Contact, Testing.Project, Testing.Organization],
43
- AiService,
28
+ schema: [TestSchema.Person, TestSchema.Project, TestSchema.Organization],
44
29
  exaApiKey: EXA_API_KEY,
45
30
  });
46
31
 
@@ -50,8 +35,7 @@ describe.skip('Search', () => {
50
35
  test('a19z org, projects they invest in and team', { timeout: 60_000 }, async () => {
51
36
  const objects = await search({
52
37
  query: 'a19z org, projects they invest in and team',
53
- schema: [Testing.Project, Testing.Organization, Testing.Contact],
54
- AiService,
38
+ schema: [TestSchema.Project, TestSchema.Organization, TestSchema.Person],
55
39
  exaApiKey: EXA_API_KEY,
56
40
  });
57
41
 
@@ -61,8 +45,7 @@ describe.skip('Search', () => {
61
45
  test('companies building CRDTs', { timeout: 60_000 }, async () => {
62
46
  const objects = await search({
63
47
  query: 'companies building CRDTs',
64
- schema: [Testing.Project, Testing.Organization, Testing.Contact],
65
- AiService,
48
+ schema: [TestSchema.Project, TestSchema.Organization, TestSchema.Person],
66
49
  exaApiKey: EXA_API_KEY,
67
50
  });
68
51
 
@@ -74,8 +57,7 @@ describe.skip('Search', () => {
74
57
  test('composer context-based search', { timeout: 60_000 }, async () => {
75
58
  const objects = await search({
76
59
  context: COMPOSER_DXOS_DOC,
77
- schema: [Testing.Project, Testing.Organization, Testing.Contact],
78
- AiService,
60
+ schema: [TestSchema.Project, TestSchema.Organization, TestSchema.Person],
79
61
  exaApiKey: EXA_API_KEY,
80
62
  });
81
63
 
@@ -85,8 +67,7 @@ describe.skip('Search', () => {
85
67
  test.only('edge architecture', { timeout: 60_000 }, async () => {
86
68
  const objects = await search({
87
69
  context: EDGE_ARCHITECTURE_DOC,
88
- schema: [Testing.Project, Testing.Organization, Testing.Contact],
89
- AiService,
70
+ schema: [TestSchema.Project, TestSchema.Organization, TestSchema.Person],
90
71
  exaApiKey: EXA_API_KEY,
91
72
  });
92
73
 
@@ -95,9 +76,7 @@ describe.skip('Search', () => {
95
76
  });
96
77
  });
97
78
 
98
- // TODO(dmaretskyi): Import as txt.
99
79
  const COMPOSER_DXOS_DOC = `
100
-
101
80
  ![img](https://dxos.network/dxos-logotype-blue.png)
102
81
  # Welcome to Composer by DXOS
103
82
 
@@ -105,7 +84,7 @@ const COMPOSER_DXOS_DOC = `
105
84
 
106
85
  Composer is an extensible application that includes familiar components such as documents, diagrams, and tables. It leverages DXOS — a full stack framework for building collaborative local-first applications.
107
86
 
108
- With our upcoming SDK, you'll be able to build custom plugins, leverage external APIs and integrate with LLMs. All inside of a private collaborative workspace.
87
+ With our SDK, you'll be able to build custom plugins, leverage external APIs and integrate with LLMs. All inside of a private collaborative workspace.
109
88
 
110
89
  ## Disclaimer
111
90
 
@@ -231,6 +210,4 @@ const EDGE_ARCHITECTURE_DOC = `
231
210
  - 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
211
 
233
212
  ### Service Side
234
-
235
-
236
213
  `;