@mindstudio-ai/agent 0.1.83 → 0.1.84

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
@@ -1803,3 +1803,40 @@ const { url } = await mindstudio.uploadFile(readFileSync('photo.png'), { extensi
1803
1803
  - `options.type`: string (optional) — MIME type (e.g. `"image/png"`). Determines which CDN subdomain is used.
1804
1804
 
1805
1805
  Output: `{ url: string }` — The permanent public CDN URL.
1806
+
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.
1809
+
1810
+ ```typescript
1811
+ import { files } from '@mindstudio-ai/agent';
1812
+
1813
+ // Define stores at module scope (access is pinned here).
1814
+ export const Uploads = files.defineStore('uploads'); // private (default)
1815
+ export const Assets = files.defineStore('assets', { access: 'public' });
1816
+
1817
+ // Store bytes and get a ready-to-use URL.
1818
+ const file = await Uploads.put(buffer, { contentType: 'application/pdf', filename: 'report.pdf' });
1819
+ file.url; // stable on-domain URL for a logged-in user (drop into <img>/<a download>)
1820
+ await file.shareUrl(); // absolute signed URL that works with NO session (email/embed); default 24h
1821
+ ```
1822
+
1823
+ Store methods:
1824
+ - `put(content, { key?, contentType?, filename?, contentAddressed? })` → `StoredFile`. `content` is `Buffer | Uint8Array | string`. Omit `key` for a random UUID; `contentAddressed: true` derives an immutable `<sha256>.<ext>` key.
1825
+ - `get(key)` → `Buffer` · `head(key)` → `StoredFile` · `exists(key)` → `boolean`
1826
+ - `list({ prefix?, cursor?, limit? })` → `{ files: StoredFile[]; cursor? }`
1827
+ - `delete(key)` → `void`
1828
+ - `shareUrl(key, { expiresIn? })` → signed absolute URL (private stores; no session needed)
1829
+
1830
+ `StoredFile`: `{ store, key, access, size?, contentType?, updatedAt?, url, shareUrl() }`.
1831
+
1832
+ `defineStore(name, options?)` options: `access: 'public' | 'private'` (default private), `maxSize` (bytes; cap for client-direct uploads), `contentTypes` (allowlist for client-direct uploads).
1833
+
1834
+ User uploads (client-direct — bytes go straight to storage, never through the app backend): a backend method mints a token, the frontend submits it with `@mindstudio-ai/interface`.
1835
+ ```typescript
1836
+ // backend method
1837
+ const token = await Uploads.createUploadToken({ contentType, maxSize: 25 * 1024 * 1024 });
1838
+ return token;
1839
+ // frontend (@mindstudio-ai/interface)
1840
+ import { platform } from '@mindstudio-ai/interface';
1841
+ const { url } = await platform.upload(token, file, { onProgress });
1842
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/agent",
3
- "version": "0.1.83",
3
+ "version": "0.1.84",
4
4
  "description": "TypeScript SDK for MindStudio direct step execution",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",