@mindstudio-ai/agent 0.1.85 → 0.1.87

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/llms.txt CHANGED
@@ -8,7 +8,7 @@ This file is the complete API reference. No other documentation is needed to use
8
8
 
9
9
  There are 150+ actions available. Do NOT try to read or load them all at once. Follow this discovery flow:
10
10
 
11
- 1. **Identify yourself** — Call `changeName` to set your display name (use your name or whatever your user calls you). If you have a profile picture or icon, call `uploadFile` to upload it, then `changeProfilePicture` with the returned URL. This helps users identify your requests in their logs.
11
+ 1. **Identify yourself** — Call `changeName` to set your display name (use your name or whatever your user calls you). If you have a profile picture, pass its public image URL to `changeProfilePicture`. This helps users identify your requests in their logs.
12
12
  2. **Ask** — Use `mindstudio ask "your question"` (CLI) or the `ask` MCP tool for SDK guidance. It knows every action, model, and connector and returns working TypeScript code with real model IDs and config options. Examples: `mindstudio ask "generate an image with FLUX"`, `mindstudio ask "what models support vision?"`, `mindstudio ask "how do I send a Slack message?"`.
13
13
  3. **Browse** — For manual discovery, call `listActions` (MCP tool) or `mindstudio list-actions --summary` (CLI) to get a compact `{ action: description }` map of everything available (~3k tokens). Call `mindstudio info <action>` (CLI) for parameter details.
14
14
  4. **Call it** — Invoke the action with the required parameters. All actions share the same calling convention (see below).
@@ -1791,7 +1791,7 @@ await mindstudio.changeProfilePicture('https://example.com/avatar.png');
1791
1791
  ```
1792
1792
 
1793
1793
  #### `uploadFile(content, options)`
1794
- Upload a file to the MindStudio CDN. Gets a signed upload URL, PUTs the file content, and returns the permanent public URL.
1794
+ **Deprecated for app file storage** — use the `files` store below (`files.defineStore(...).put(...)`): private by default, app-scoped, and served on the app's own domain. `uploadFile` uploads to the shared account media CDN and remains only for account-level assets (e.g. an agent avatar for `changeProfilePicture`). Gets a signed upload URL, PUTs the file content, and returns the permanent public URL.
1795
1795
 
1796
1796
  ```typescript
1797
1797
  import { readFileSync } from 'fs';
@@ -1840,3 +1840,38 @@ return token;
1840
1840
  import { platform } from '@mindstudio-ai/interface';
1841
1841
  const { url } = await platform.upload(token, file, { onProgress });
1842
1842
  ```
1843
+
1844
+ #### `dataSources` — searchable document corpora (RAG)
1845
+
1846
+ Declare a data source at module scope and import the handle. The platform owns parsing, chunking, embedding, storage and tenant isolation; every hit returns a citation.
1847
+ ```typescript
1848
+ import { dataSources } from '@mindstudio-ai/agent';
1849
+ export const Policies = dataSources.defineDataSource('policies');
1850
+
1851
+ // search
1852
+ const { results } = await Policies.search('what are the payment terms?', { topK: 5 });
1853
+ // options: topK (default 5, max 50), scoreThreshold, rerank, hybrid — the last two default on
1854
+ const context = results.map((r) => r.text).join(String.fromCharCode(10, 10));
1855
+
1856
+ // add a document (background — poll documents() for status)
1857
+ await Policies.add(buffer, { filename: 'policy.pdf', contentType: 'application/pdf' });
1858
+ const docs = await Policies.documents();
1859
+
1860
+ // introspection — what is in the corpus, and how one document was split
1861
+ const { chunkCount, pipeline } = await Policies.stats(); // counts + the config actually in effect
1862
+ const chunks = await Policies.chunks(docs[0].id); // why a document does or doesn't match
1863
+ ```
1864
+
1865
+ `SearchHit`: `{ score, text, citation: { documentId, filename, pageNumber, chunkIndex, headingPath, boundingBox?, url } }`. `citation.url` is a stable on-domain link to the source document — drop it in an `<a href>`. `(documentId, chunkIndex)` is a chunk's stable identity — key an eval set on that, not on `text`.
1866
+
1867
+ Also on each hit: `retrievalRank`/`retrievalScore` (position before reranking — compare with the final position to see what reranking did). Two opt-in search options for debugging: `explain: true` adds `explain.{dense,lexical,matchedVia}` so you can see which half of hybrid found a hit, and `expand: 1` adds `neighbors.{before,after}` for surrounding context. Neither changes the results or their order.
1868
+
1869
+ Search is deterministic for a fixed corpus and configuration — same query, same order — so regression checks are meaningful. `search()` also returns `latencyMs`.
1870
+
1871
+ Supported: pdf, docx, pptx, xlsx, odt, rtf, epub, images, txt, md, json, csv, html.
1872
+
1873
+ Adding the same bytes twice is free — documents are content-addressed, so a re-add is a no-op when this source has already processed those exact bytes under its current configuration. Only reconfiguring the source makes a re-add do work again, and that is an explicit owner-triggered migration, never a side effect of a deploy.
1874
+
1875
+ `rerank` and `hybrid` are free to change and take effect on the next search. How documents are chunked and embedded is configured on the corpus itself with `mindstudio-prod datasources config` — not in code — and changing it on a populated source is rejected rather than silently rebuilding.
1876
+
1877
+ **A data source is live and shared.** Unlike database tables there is no dev copy and no per-release isolation: adding or removing a document changes what the deployed app retrieves, immediately. Scenarios never reset a data source, and re-ingesting a large corpus costs real money.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/agent",
3
- "version": "0.1.85",
3
+ "version": "0.1.87",
4
4
  "description": "TypeScript SDK for MindStudio direct step execution",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",