@mindstudio-ai/agent 0.1.101 → 0.1.102
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/README.md +6 -0
- package/dist/cli.js +30 -16
- package/dist/index.d.ts +44 -0
- package/dist/index.js +41 -11
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +30 -16
- package/llms.txt +3 -3
- package/package.json +1 -1
package/llms.txt
CHANGED
|
@@ -1810,7 +1810,7 @@ const { url } = await mindstudio.uploadFile(readFileSync('photo.png'), { extensi
|
|
|
1810
1810
|
Output: `{ url: string }` — The permanent public CDN URL.
|
|
1811
1811
|
|
|
1812
1812
|
#### `files` — per-app file storage (private by default)
|
|
1813
|
-
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.
|
|
1813
|
+
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. Public objects are CDN-cached per their `Cache-Control`, set at put time via `cacheControl`: auto-minted keys default to immutable (cache-forever — the key is never reused), and named keys default to `public, max-age=300`, so overwriting one propagates publicly within ~5 minutes; pass `cacheControl` to tune (e.g. `'public, max-age=60'` for near-live config, `'no-store'` to revalidate every read). 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.
|
|
1814
1814
|
|
|
1815
1815
|
```typescript
|
|
1816
1816
|
import { files } from '@mindstudio-ai/agent';
|
|
@@ -1826,7 +1826,7 @@ await file.shareUrl(); // absolute signed URL that works with NO session (email/
|
|
|
1826
1826
|
```
|
|
1827
1827
|
|
|
1828
1828
|
Store methods:
|
|
1829
|
-
- `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.
|
|
1829
|
+
- `put(content, { key?, contentType?, filename?, contentAddressed?, cacheControl? })` → `StoredFile`. `content` is `Buffer | Uint8Array | string`. Omit `key` for a random UUID; `contentAddressed: true` derives an immutable `<sha256>.<ext>` key. `cacheControl` sets the CDN caching of a public object (defaults: auto-minted keys immutable, named keys `public, max-age=300`).
|
|
1830
1830
|
- `get(key)` → `Buffer` · `head(key)` → `StoredFile` · `exists(key)` → `boolean`
|
|
1831
1831
|
- `list({ prefix?, cursor?, limit? })` → `{ files: StoredFile[]; cursor? }`
|
|
1832
1832
|
- `delete(key)` → `void`
|
|
@@ -1839,7 +1839,7 @@ Store methods:
|
|
|
1839
1839
|
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`.
|
|
1840
1840
|
```typescript
|
|
1841
1841
|
// backend method
|
|
1842
|
-
const token = await Uploads.createUploadToken({ contentType, maxSize: 25 * 1024 * 1024 });
|
|
1842
|
+
const token = await Uploads.createUploadToken({ contentType, maxSize: 25 * 1024 * 1024 }); // also accepts cacheControl
|
|
1843
1843
|
return token;
|
|
1844
1844
|
// frontend (@mindstudio-ai/interface)
|
|
1845
1845
|
import { platform } from '@mindstudio-ai/interface';
|