@mindstudio-ai/agent 0.1.83 → 0.1.85

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 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
+
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.85",
4
4
  "description": "TypeScript SDK for MindStudio direct step execution",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",