@mindstudio-ai/agent 0.1.84 → 0.1.86

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
@@ -1805,7 +1805,7 @@ const { url } = await mindstudio.uploadFile(readFileSync('photo.png'), { extensi
1805
1805
  Output: `{ url: string }` — The permanent public CDN URL.
1806
1806
 
1807
1807
  #### `files` — per-app file storage (private by default)
1808
- Typed file storage for the app — the twin of the `db` namespace. Define a store at module scope, then read/write objects. Files are served on the app's own domain. Private stores (the default) are signed / session-authorized; public stores are world-readable, CDN-served, and images are resizable via query params (e.g. `?w=400&h=300&fit=cover`). Prefer this over the deprecated `uploadFile()` for app storage.
1808
+ Typed per-app file storage: user uploads, generated documents, images, marketing assets. Think of a store as a CDN-backed bucket the app talks to — NOT app-defined state like a `db` table. The API is *shaped* like the `db` namespace (define a store at module scope, then read/write), but its contents aren't modeled by code, and one store is shared across dev and prod (a file uploaded in the dev editor is already live in prod at the same URL). Creates are safe by default because keys default to unique (UUID, or a content-addressed hash); the operations to treat with care are `delete(key)` and overwriting a fixed key. Files are served on the app's own domain: private stores (the default) are signed / session-authorized; public stores are world-readable, CDN-served, and images resize via query params (e.g. `?w=400&h=300&fit=cover`). Prefer this over the deprecated `uploadFile()` for app storage.
1809
1809
 
1810
1810
  ```typescript
1811
1811
  import { files } from '@mindstudio-ai/agent';
@@ -1840,3 +1840,30 @@ 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
+
1861
+ `SearchHit`: `{ score, text, citation: { documentId, filename, pageNumber, headingPath, boundingBox?, url } }`. `citation.url` is a stable on-domain link to the source document — drop it in an `<a href>`.
1862
+
1863
+ Supported: pdf, docx, pptx, xlsx, odt, rtf, epub, images, txt, md, json, csv, html.
1864
+
1865
+ 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.
1866
+
1867
+ `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.
1868
+
1869
+ **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.84",
3
+ "version": "0.1.86",
4
4
  "description": "TypeScript SDK for MindStudio direct step execution",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",