From 0e1286628034f81af59ea7d453ac1545009741bc Mon Sep 17 00:00:00 2001 From: Michael Gartner Date: Mon, 8 Jun 2026 23:44:08 -0600 Subject: [PATCH 1/3] Add semantic search Roam API types --- src/testing/mockRoamEnvironment.ts | 9 +++++++++ src/types/index.ts | 3 +++ src/types/native.ts | 16 ++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/src/testing/mockRoamEnvironment.ts b/src/testing/mockRoamEnvironment.ts index 135218d..93ebe31 100644 --- a/src/testing/mockRoamEnvironment.ts +++ b/src/testing/mockRoamEnvironment.ts @@ -1480,11 +1480,20 @@ const mockRoamEnvironment = () => { }; global.window.roamAlphaAPI.data = { ...global.window.roamAlphaAPI.data, + semanticSearchEnabled: () => false, fast: { q: (query, ..._params) => { return mockQuery({ graph, query }); }, }, + async: { + ...global.window.roamAlphaAPI.data?.async, + semanticSearch: async () => { + throw new Error( + "Semantic search is not available in mockRoamEnvironment" + ); + }, + }, }; global.window.roamAlphaAPI.util = { ...global.window.roamAlphaAPI.util, diff --git a/src/types/index.ts b/src/types/index.ts index d7f3a0d..8321f93 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,6 +1,7 @@ import { AddPullWatch, PullBlock, + SemanticSearch, SidebarAction, SidebarWindow, SidebarWindowInput, @@ -102,6 +103,7 @@ declare global { }; data: { addPullWatch: AddPullWatch; + semanticSearchEnabled: () => boolean; block: { create: WriteAction; update: WriteAction; @@ -125,6 +127,7 @@ declare global { pattern: string, eids: string[][], ) => Promise; + semanticSearch: SemanticSearch; fast: { q: (query: string, ...params: unknown[]) => Promise; }; diff --git a/src/types/native.ts b/src/types/native.ts index c3b5124..5dfc318 100644 --- a/src/types/native.ts +++ b/src/types/native.ts @@ -332,6 +332,22 @@ export type RoamError = { "status-code": number; }; +export type SemanticSearchArgs = { + "search-str": string; + k?: number; + "hide-code-blocks"?: boolean; +}; + +export type SemanticSearchHit = { + type: "chunk" | "block" | "page"; + uid: string; + topUids: string[]; +}; + +export type SemanticSearch = ( + args: SemanticSearchArgs +) => Promise; + export type TreeNode = { text: string; order: number; From 6c605542b957bd075a34014798d18367ca2e367c Mon Sep 17 00:00:00 2001 From: Michael Gartner Date: Tue, 9 Jun 2026 00:00:29 -0600 Subject: [PATCH 2/3] 0.88.2 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index e1c953e..0307ede 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "roamjs-components", - "version": "0.88.1", + "version": "0.88.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "roamjs-components", - "version": "0.88.1", + "version": "0.88.2", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 454cc04..6d5eaf8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "roamjs-components", "description": "Expansive toolset, utilities, & components for developing RoamJS extensions.", - "version": "0.88.1", + "version": "0.88.2", "main": "index.js", "types": "index.d.ts", "scripts": { From 20be4ed55d08903828e96d9c60f18bce6f133df2 Mon Sep 17 00:00:00 2001 From: Michael Gartner Date: Tue, 9 Jun 2026 00:03:29 -0600 Subject: [PATCH 3/3] Remove semantic search mock defaults --- src/testing/mockRoamEnvironment.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/testing/mockRoamEnvironment.ts b/src/testing/mockRoamEnvironment.ts index 93ebe31..135218d 100644 --- a/src/testing/mockRoamEnvironment.ts +++ b/src/testing/mockRoamEnvironment.ts @@ -1480,20 +1480,11 @@ const mockRoamEnvironment = () => { }; global.window.roamAlphaAPI.data = { ...global.window.roamAlphaAPI.data, - semanticSearchEnabled: () => false, fast: { q: (query, ..._params) => { return mockQuery({ graph, query }); }, }, - async: { - ...global.window.roamAlphaAPI.data?.async, - semanticSearch: async () => { - throw new Error( - "Semantic search is not available in mockRoamEnvironment" - ); - }, - }, }; global.window.roamAlphaAPI.util = { ...global.window.roamAlphaAPI.util,