@mindstudio-ai/agent 0.1.120 → 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
@@ -2755,6 +2755,13 @@ declare class DataSource {
2755
2755
  * corpora reload inside the search and never raise it. Sources on dedicated
2756
2756
  * capacity are never evicted, so they never raise it either; they raise
2757
2757
  * `capacity_hibernated` and friends instead when their capacity is parked.
2758
+ *
2759
+ * **Throws `index_building`** (HTTP 503) on dedicated capacity while a bulk
2760
+ * load runs and after one finishes: the index is not built behind every
2761
+ * write during a load, it is built once at the end, and until then a search
2762
+ * would scan the corpus unindexed. The message carries "N of M vectors
2763
+ * indexed". Handle it like `index_warming`: the knowledge base is being
2764
+ * built, never empty; say so and retry later.
2758
2765
  */
2759
2766
  search(query: string, options?: SearchOptions): Promise<{
2760
2767
  results: SearchHit[];
@@ -2784,6 +2791,32 @@ declare class DataSource {
2784
2791
  * someone migrates it.
2785
2792
  */
2786
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
+ }>;
2787
2820
  /**
2788
2821
  * Every chunk of one document, exactly as it was indexed.
2789
2822
  *
@@ -2838,12 +2871,14 @@ declare class DataSource {
2838
2871
  ids?: string[];
2839
2872
  }): Promise<DataSourceDocument[]>;
2840
2873
  /**
2841
- * One page of the corpus, oldest first, with the cursor for the next page.
2842
- * `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).
2843
2877
  */
2844
2878
  documentsPage(options?: {
2845
2879
  cursor?: string | null;
2846
2880
  limit?: number;
2881
+ order?: 'oldest' | 'newest';
2847
2882
  }): Promise<DataSourceDocumentPage>;
2848
2883
  /**
2849
2884
  * Every document in the corpus, oldest first, a page at a time behind the
@@ -2917,6 +2952,12 @@ declare class DataSource {
2917
2952
  sync(options?: {
2918
2953
  /** Override the connector's per-sync budget for this run, in dollars. */
2919
2954
  budgetDollars?: number;
2955
+ /**
2956
+ * Embed at the provider's priority tier for this run: calls are admitted
2957
+ * ahead of the provider's queue at 1.5x the embedding price. For the sync
2958
+ * where the clock matters more than the price; off by default.
2959
+ */
2960
+ priority?: boolean;
2920
2961
  }): Promise<{
2921
2962
  job: DataSourceJob;
2922
2963
  }>;
@@ -11848,6 +11889,13 @@ interface MapRunObject {
11848
11889
  metadata: DocumentMetadata | null;
11849
11890
  /** Short-lived read URL for the object's bytes. */
11850
11891
  url: string;
11892
+ /**
11893
+ * The object's bytes, base64, when the platform already held them (it
11894
+ * hashes and lands every object before mapping, and small objects ride
11895
+ * along). Present, it is the bytes; `url` is the fallback for large objects
11896
+ * and for frames from a platform that predates it.
11897
+ */
11898
+ content?: string;
11851
11899
  }
11852
11900
  interface MapRunParams {
11853
11901
  v: 1;
package/dist/index.js CHANGED
@@ -2874,6 +2874,13 @@ var DataSource = class {
2874
2874
  * corpora reload inside the search and never raise it. Sources on dedicated
2875
2875
  * capacity are never evicted, so they never raise it either; they raise
2876
2876
  * `capacity_hibernated` and friends instead when their capacity is parked.
2877
+ *
2878
+ * **Throws `index_building`** (HTTP 503) on dedicated capacity while a bulk
2879
+ * load runs and after one finishes: the index is not built behind every
2880
+ * write during a load, it is built once at the end, and until then a search
2881
+ * would scan the corpus unindexed. The message carries "N of M vectors
2882
+ * indexed". Handle it like `index_warming`: the knowledge base is being
2883
+ * built, never empty; say so and retry later.
2877
2884
  */
2878
2885
  async search(query, options) {
2879
2886
  const { results, mode, latencyMs } = await this._call("search", {
@@ -2922,6 +2929,35 @@ var DataSource = class {
2922
2929
  async stats() {
2923
2930
  return this._call("stats", { slug: this._slug });
2924
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
+ }
2925
2961
  /**
2926
2962
  * Every chunk of one document, exactly as it was indexed.
2927
2963
  *
@@ -2993,14 +3029,16 @@ var DataSource = class {
2993
3029
  return documents2 ?? [];
2994
3030
  }
2995
3031
  /**
2996
- * One page of the corpus, oldest first, with the cursor for the next page.
2997
- * `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).
2998
3035
  */
2999
3036
  async documentsPage(options) {
3000
3037
  const { documents: documents2, nextCursor } = await this._call("documents", {
3001
3038
  slug: this._slug,
3002
3039
  ...options?.cursor ? { cursor: options.cursor } : {},
3003
- ...options?.limit ? { limit: options.limit } : {}
3040
+ ...options?.limit ? { limit: options.limit } : {},
3041
+ ...options?.order ? { order: options.order } : {}
3004
3042
  });
3005
3043
  return { documents: documents2 ?? [], nextCursor: nextCursor ?? null };
3006
3044
  }
@@ -3102,7 +3140,8 @@ var DataSource = class {
3102
3140
  async sync(options) {
3103
3141
  return this._call("sync", {
3104
3142
  slug: this._slug,
3105
- ...options?.budgetDollars !== void 0 ? { budgetDollars: options.budgetDollars } : {}
3143
+ ...options?.budgetDollars !== void 0 ? { budgetDollars: options.budgetDollars } : {},
3144
+ ...options?.priority ? { priority: true } : {}
3106
3145
  });
3107
3146
  }
3108
3147
  /** Recent ingestion jobs on this source (syncs and CLI loads), newest first. */
@@ -7955,7 +7994,9 @@ function objectFor(input) {
7955
7994
  let cached = null;
7956
7995
  const bytes = () => {
7957
7996
  if (!cached) {
7958
- cached = (async () => {
7997
+ cached = input.content !== void 0 ? Promise.resolve(
7998
+ new Uint8Array(Buffer.from(input.content, "base64"))
7999
+ ) : (async () => {
7959
8000
  const response = await fetch(input.url);
7960
8001
  if (!response.ok) {
7961
8002
  throw new Error(