@mindstudio-ai/agent 0.1.89 → 0.1.91
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/cli.js +88 -16
- package/dist/index.d.ts +142 -1
- package/dist/index.js +84 -10
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +88 -16
- package/llms.txt +21 -6
- package/package.json +2 -1
package/llms.txt
CHANGED
|
@@ -417,8 +417,9 @@ Download a file from a URL and extract its text content. Supports PDFs (includin
|
|
|
417
417
|
- Handles both text-layer PDFs and image-based/scanned PDFs (e.g. Figma/Canva exports, scanned documents). Image-based PDFs are processed with OCR automatically — there is no need to convert PDF pages to images first.
|
|
418
418
|
- Accepts a single URL, a comma-separated list of URLs, or a JSON array of URLs.
|
|
419
419
|
- Files are rehosted on the MindStudio CDN before extraction.
|
|
420
|
+
- Optionally set `model` to a specific document-extraction model (`mistral-ocr-latest`, `llamaparse`, `google-document-ai`); omit to use the platform default.
|
|
420
421
|
- Maximum file size is 50MB per URL.
|
|
421
|
-
- Input: `{ url: string | string[] }`
|
|
422
|
+
- Input: `{ url: string | string[], model?: string }`
|
|
422
423
|
- Output: `{ text: string | string[] }`
|
|
423
424
|
|
|
424
425
|
#### fetchDataSourceDocument
|
|
@@ -1856,11 +1857,21 @@ export const Policies = dataSources.defineDataSource('policies');
|
|
|
1856
1857
|
|
|
1857
1858
|
// search
|
|
1858
1859
|
const { results } = await Policies.search('what are the payment terms?', { topK: 5 });
|
|
1859
|
-
// options: topK (default 5, max 50), scoreThreshold,
|
|
1860
|
+
// options: topK (default 5, max 50), scoreThreshold, filter, mode, maxPerDocument, highlight, rerank, hybrid
|
|
1860
1861
|
const context = results.map((r) => r.text).join(String.fromCharCode(10, 10));
|
|
1861
1862
|
|
|
1863
|
+
// narrow before ranking: metadata tags, filename, pages, required words
|
|
1864
|
+
await Policies.search('termination clause', {
|
|
1865
|
+
filter: { metadata: { department: 'legal', year: [2025, 2026] }, phrase: 'notice period' },
|
|
1866
|
+
maxPerDocument: 2, // stop one document monopolizing the results
|
|
1867
|
+
});
|
|
1868
|
+
|
|
1869
|
+
// mode: 'hybrid' (default) | 'semantic' | 'lexical'. Lexical skips the query
|
|
1870
|
+
// embedding — fastest, right for identifier-shaped queries (error codes, SKUs).
|
|
1871
|
+
await Policies.search('ERR-7741X', { mode: 'lexical' });
|
|
1872
|
+
|
|
1862
1873
|
// add a document (background — poll documents() for status)
|
|
1863
|
-
await Policies.add(buffer, { filename: 'policy.pdf', contentType: 'application/pdf' });
|
|
1874
|
+
await Policies.add(buffer, { filename: 'policy.pdf', contentType: 'application/pdf', metadata: { department: 'legal' } });
|
|
1864
1875
|
const docs = await Policies.documents();
|
|
1865
1876
|
|
|
1866
1877
|
// introspection — what is in the corpus, and how one document was split
|
|
@@ -1870,14 +1881,18 @@ const chunks = await Policies.chunks(docs[0].id); // why a document does o
|
|
|
1870
1881
|
|
|
1871
1882
|
`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`.
|
|
1872
1883
|
|
|
1873
|
-
Also on each hit: `retrievalRank`/`retrievalScore` (position before reranking — compare with the final position to see what reranking did).
|
|
1884
|
+
Also on each hit: `retrievalRank`/`retrievalScore` (position before reranking — compare with the final position to see what reranking did). Three opt-in search options for debugging and display: `explain: true` adds `explain.{dense,lexical,matchedVia}` so you can see which half of hybrid found a hit; `expand: 1` adds `neighbors.{before,after}` for surrounding context; `highlight: true` adds `matches` — `{start, end}` offsets of query terms in `text`, for rendering highlights. None of them changes the results or their order.
|
|
1885
|
+
|
|
1886
|
+
`filter` fields (all AND together, and only narrow): `metadata` (per-key equals, or any-of via an array), `filename`, `documentIds`, `pages: {min?, max?}`, `contains` (all words, any order), `phrase` (exact adjacent sequence). Document metadata is set at add time: scalars only, ≤16 keys, keys `[a-zA-Z0-9_-]`. Re-adding the same bytes with different metadata updates the tags in place — no re-processing.
|
|
1874
1887
|
|
|
1875
1888
|
Search is deterministic for a fixed corpus and configuration — same query, same order — so regression checks are meaningful. `search()` also returns `latencyMs`.
|
|
1876
1889
|
|
|
1877
|
-
|
|
1890
|
+
Other methods: `stats()`, `documents()`, `chunks(documentId, {vectors?})`, `remove(documentId)`, `ensure(name?)` (rarely needed — `add` and `search` create-on-reference), and `DataSource.contentHash(bytes)` to check for an existing document before adding.
|
|
1891
|
+
|
|
1892
|
+
Supported: pdf, docx, pptx, xlsx, odt, rtf, epub, images, txt, md, json, csv, tsv, log, html.
|
|
1878
1893
|
|
|
1879
1894
|
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.
|
|
1880
1895
|
|
|
1881
|
-
`
|
|
1896
|
+
Everything in `SearchOptions` — `mode`, `filter`, `rerank`, `hybrid`, `maxPerDocument`, `highlight` — is free to change and takes 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.
|
|
1882
1897
|
|
|
1883
1898
|
**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.
|
|
3
|
+
"version": "0.1.91",
|
|
4
4
|
"description": "TypeScript SDK for MindStudio direct step execution",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"codegen": "tsx scripts/codegen.ts",
|
|
27
27
|
"typecheck": "tsc --noEmit",
|
|
28
28
|
"postinstall": "node dist/postinstall.js || true",
|
|
29
|
+
"bump-consumers": "node scripts/bump-consumers.mjs",
|
|
29
30
|
"prepare": "npm run build",
|
|
30
31
|
"prepublishOnly": "npm run build"
|
|
31
32
|
},
|