@mindstudio-ai/agent 0.1.121 → 0.1.122

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.d.ts CHANGED
@@ -2791,6 +2791,32 @@ declare class DataSource {
2791
2791
  * someone migrates it.
2792
2792
  */
2793
2793
  stats(): Promise<DataSourceStats>;
2794
+ /**
2795
+ * How many passages (chunks) match a filter — exact, over the whole corpus.
2796
+ *
2797
+ * The honest number to show beside a search's hits: `count({ contains:
2798
+ * query })` is how many passages contain **all** the query's words, so a UI
2799
+ * can say "8 of 3,891 passages mention these words" and mean it. Same
2800
+ * grammar as {@link SearchOptions.filter}, so it also answers "how many
2801
+ * passages are tagged `department: 'legal'`" or contain an exact `phrase`.
2802
+ * No filter counts the whole corpus.
2803
+ *
2804
+ * What it is not: a relevance count. Similarity is a continuous score over
2805
+ * every chunk and no such total exists, so do not label this "relevant
2806
+ * results" or "matches for your query". It is also not the set `search`
2807
+ * returns: the semantic branch surfaces passages without the words, and the
2808
+ * lexical branch scores partial overlap. Chunks, not documents — a long
2809
+ * document contributes several.
2810
+ *
2811
+ * Counts share the search rate limit (300/minute per app); a count paired
2812
+ * with every search spends two. Cheap otherwise: one index lookup, no model
2813
+ * call. Shows the same `index_warming` / `index_building` as search while a
2814
+ * corpus is loading or building, never a false `0`.
2815
+ */
2816
+ count(filter?: SearchFilter): Promise<{
2817
+ chunks: number;
2818
+ latencyMs: number;
2819
+ }>;
2794
2820
  /**
2795
2821
  * Every chunk of one document, exactly as it was indexed.
2796
2822
  *
@@ -2845,12 +2871,14 @@ declare class DataSource {
2845
2871
  ids?: string[];
2846
2872
  }): Promise<DataSourceDocument[]>;
2847
2873
  /**
2848
- * One page of the corpus, oldest first, with the cursor for the next page.
2849
- * `limit` is at most 1,000 (the default).
2874
+ * One page of the corpus with the cursor for the next page. Oldest first
2875
+ * unless `order: 'newest'` — the page an app shows as "what just arrived"
2876
+ * without walking anything. `limit` is at most 1,000 (the default).
2850
2877
  */
2851
2878
  documentsPage(options?: {
2852
2879
  cursor?: string | null;
2853
2880
  limit?: number;
2881
+ order?: 'oldest' | 'newest';
2854
2882
  }): Promise<DataSourceDocumentPage>;
2855
2883
  /**
2856
2884
  * Every document in the corpus, oldest first, a page at a time behind the
package/dist/index.js CHANGED
@@ -2929,6 +2929,35 @@ var DataSource = class {
2929
2929
  async stats() {
2930
2930
  return this._call("stats", { slug: this._slug });
2931
2931
  }
2932
+ /**
2933
+ * How many passages (chunks) match a filter — exact, over the whole corpus.
2934
+ *
2935
+ * The honest number to show beside a search's hits: `count({ contains:
2936
+ * query })` is how many passages contain **all** the query's words, so a UI
2937
+ * can say "8 of 3,891 passages mention these words" and mean it. Same
2938
+ * grammar as {@link SearchOptions.filter}, so it also answers "how many
2939
+ * passages are tagged `department: 'legal'`" or contain an exact `phrase`.
2940
+ * No filter counts the whole corpus.
2941
+ *
2942
+ * What it is not: a relevance count. Similarity is a continuous score over
2943
+ * every chunk and no such total exists, so do not label this "relevant
2944
+ * results" or "matches for your query". It is also not the set `search`
2945
+ * returns: the semantic branch surfaces passages without the words, and the
2946
+ * lexical branch scores partial overlap. Chunks, not documents — a long
2947
+ * document contributes several.
2948
+ *
2949
+ * Counts share the search rate limit (300/minute per app); a count paired
2950
+ * with every search spends two. Cheap otherwise: one index lookup, no model
2951
+ * call. Shows the same `index_warming` / `index_building` as search while a
2952
+ * corpus is loading or building, never a false `0`.
2953
+ */
2954
+ async count(filter) {
2955
+ const { chunks, latencyMs } = await this._call("count", {
2956
+ slug: this._slug,
2957
+ ...filter !== void 0 ? { filter } : {}
2958
+ });
2959
+ return { chunks: chunks ?? 0, latencyMs: latencyMs ?? 0 };
2960
+ }
2932
2961
  /**
2933
2962
  * Every chunk of one document, exactly as it was indexed.
2934
2963
  *
@@ -3000,14 +3029,16 @@ var DataSource = class {
3000
3029
  return documents2 ?? [];
3001
3030
  }
3002
3031
  /**
3003
- * One page of the corpus, oldest first, with the cursor for the next page.
3004
- * `limit` is at most 1,000 (the default).
3032
+ * One page of the corpus with the cursor for the next page. Oldest first
3033
+ * unless `order: 'newest'` — the page an app shows as "what just arrived"
3034
+ * without walking anything. `limit` is at most 1,000 (the default).
3005
3035
  */
3006
3036
  async documentsPage(options) {
3007
3037
  const { documents: documents2, nextCursor } = await this._call("documents", {
3008
3038
  slug: this._slug,
3009
3039
  ...options?.cursor ? { cursor: options.cursor } : {},
3010
- ...options?.limit ? { limit: options.limit } : {}
3040
+ ...options?.limit ? { limit: options.limit } : {},
3041
+ ...options?.order ? { order: options.order } : {}
3011
3042
  });
3012
3043
  return { documents: documents2 ?? [], nextCursor: nextCursor ?? null };
3013
3044
  }