@raisindb/client 0.5.4 → 0.5.6

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/index.mjs CHANGED
@@ -6904,19 +6904,6 @@ var HttpDatabase = class _HttpDatabase {
6904
6904
  getBranch() {
6905
6905
  return this.branch;
6906
6906
  }
6907
- /**
6908
- * Create a new HttpDatabase instance scoped to a specific branch.
6909
- *
6910
- * @param branch - Branch name
6911
- * @returns New HttpDatabase instance with branch context
6912
- *
6913
- * @example
6914
- * ```typescript
6915
- * const db = client.database('my-repo');
6916
- * const staging = db.onBranch('staging');
6917
- * const result = await staging.executeSql('SELECT * FROM content');
6918
- * ```
6919
- */
6920
6907
  onBranch(branch) {
6921
6908
  return new _HttpDatabase(this.repository, this.client, branch);
6922
6909
  }
@@ -6964,6 +6951,63 @@ var HttpDatabase = class _HttpDatabase {
6964
6951
  (repo, name, input) => this.client.invokeFunctionSync(repo, name, input)
6965
6952
  );
6966
6953
  }
6954
+ /**
6955
+ * The retrieval implementation behind {@link search} and {@link ask}.
6956
+ *
6957
+ * The SAME `SearchApi` the WebSocket client uses, handed this transport's SQL
6958
+ * and function runners. Retrieval is one behaviour — the query shape, the
6959
+ * limit clamp, the required scope, the `grounded` fail-closed mapping — and a
6960
+ * second copy written against HTTP would drift from the first the moment
6961
+ * either is touched. Only the two runners differ.
6962
+ */
6963
+ searchApi() {
6964
+ if (!this._searchApi) {
6965
+ this._searchApi = new SearchApi(
6966
+ (sql, params) => this.executeSql(sql, params),
6967
+ async (name, input) => {
6968
+ const run = await this.functions().invoke(name, input, {
6969
+ waitForResult: true
6970
+ });
6971
+ return run?.result ?? run;
6972
+ }
6973
+ );
6974
+ }
6975
+ return this._searchApi;
6976
+ }
6977
+ /**
6978
+ * Find the passages matching a query, by meaning and by keyword at once.
6979
+ *
6980
+ * Available on this HTTP client as well as the WebSocket one, because this is
6981
+ * the client a server-side route handler reaches for — and a route handler is
6982
+ * exactly where retrieval belongs when the page is public: the browser must
6983
+ * not hold a credential that can read the repository.
6984
+ *
6985
+ * @example
6986
+ * ```typescript
6987
+ * const passages = await db.search('how much notice to terminate', {
6988
+ * workspaces: 'stories',
6989
+ * });
6990
+ * ```
6991
+ */
6992
+ async search(query, options) {
6993
+ return this.searchApi().search(query, options);
6994
+ }
6995
+ /**
6996
+ * Answer a question from the stored content, with citations.
6997
+ *
6998
+ * Check `grounded` before showing the answer: when it is false nothing
6999
+ * relevant was retrieved and the model was never asked.
7000
+ *
7001
+ * @example
7002
+ * ```typescript
7003
+ * const { answer, citations, grounded } = await db.ask(question, {
7004
+ * workspaces: 'stories, handbook',
7005
+ * });
7006
+ * ```
7007
+ */
7008
+ async ask(question, options) {
7009
+ return this.searchApi().ask(question, options);
7010
+ }
6967
7011
  /**
6968
7012
  * Get an {@link McpClient} for a content-declared MCP server on this database.
6969
7013
  *