@sylphx/sdk 0.19.3 → 0.21.0
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 +47 -3
- package/dist/index.d.ts +843 -23
- package/dist/index.mjs +766 -15
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs/index.mjs +31 -25
- package/dist/nextjs/index.mjs.map +1 -1
- package/dist/react/index.d.ts +32 -2
- package/dist/react/index.mjs +92 -9
- package/dist/react/index.mjs.map +1 -1
- package/dist/server/index.d.ts +36 -7
- package/dist/server/index.mjs +31 -29
- package/dist/server/index.mjs.map +1 -1
- package/dist/tasks.d.ts +1463 -0
- package/dist/tasks.mjs +1907 -0
- package/dist/tasks.mjs.map +1 -0
- package/package.json +10 -4
package/README.md
CHANGED
|
@@ -208,6 +208,50 @@ These helpers expose the public workflow label contract only. Applications do
|
|
|
208
208
|
not need to know the backing scheduler, cluster, runner group, capacity formula,
|
|
209
209
|
or placement details.
|
|
210
210
|
|
|
211
|
+
## Sandbox Capability Catalog
|
|
212
|
+
|
|
213
|
+
Sandbox clients expose the authenticated capability report served by the
|
|
214
|
+
exec-server:
|
|
215
|
+
|
|
216
|
+
```ts
|
|
217
|
+
import { SandboxClient } from '@sylphx/sdk'
|
|
218
|
+
|
|
219
|
+
const sandbox = await SandboxClient.create(sylphx)
|
|
220
|
+
const report = await sandbox.capabilities.get()
|
|
221
|
+
|
|
222
|
+
const storage = report.capabilities.find((capability) => capability.id === 'workspace-storage')
|
|
223
|
+
if (storage?.workspaceStorage?.pressure === 'critical') {
|
|
224
|
+
// Clean caches/artifacts, fork from a clean workspace, or offload heavy work.
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const mobile = report.capabilities.find((capability) => capability.id === 'mobile-device-test')
|
|
228
|
+
if (mobile?.status === 'not-local') {
|
|
229
|
+
// Build artifacts in the workspace or CI, then run device tests through the
|
|
230
|
+
// managed mobile device runtime when available.
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
The report is tenant-neutral and product-level. It tells agents what is local to
|
|
235
|
+
the sandbox (`exec`, files, browser, desktop) versus another Platform execution
|
|
236
|
+
plane (`ci-runner`, `managed-device-runtime`) without exposing Kubernetes
|
|
237
|
+
placement or storage internals.
|
|
238
|
+
|
|
239
|
+
Runtime workspace subtree cleanup uses the fail-closed subpath reclaim route:
|
|
240
|
+
|
|
241
|
+
```ts
|
|
242
|
+
import { reclaimWorkspaceSubpath } from '@sylphx/sdk'
|
|
243
|
+
|
|
244
|
+
await reclaimWorkspaceSubpath(sylphx, 'wksp_...', {
|
|
245
|
+
subPath: 'workspaces/session-a',
|
|
246
|
+
reason: 'retention-expired',
|
|
247
|
+
})
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Use `reclaimWorkspace` for whole-workspace archive/delete semantics only.
|
|
251
|
+
`reclaimWorkspaceSubpath` is a separate route so older Platform versions fail
|
|
252
|
+
with 404 instead of treating an unknown `subPath` field as whole-workspace
|
|
253
|
+
reclaim.
|
|
254
|
+
|
|
211
255
|
### Prefetch App Config
|
|
212
256
|
|
|
213
257
|
```ts
|
|
@@ -359,10 +403,10 @@ await openPortal()
|
|
|
359
403
|
```tsx
|
|
360
404
|
import { useAnalytics } from '@sylphx/sdk/react'
|
|
361
405
|
|
|
362
|
-
const { track, identify
|
|
406
|
+
const { track, identify } = useAnalytics()
|
|
363
407
|
|
|
364
408
|
track('button_clicked', { button: 'upgrade' })
|
|
365
|
-
identify({ name: 'John', email: 'john@example.com' })
|
|
409
|
+
identify('user-id', { name: 'John', email: 'john@example.com' })
|
|
366
410
|
```
|
|
367
411
|
|
|
368
412
|
### Feature Flags
|
|
@@ -393,7 +437,7 @@ import { useStorage } from '@sylphx/sdk/react'
|
|
|
393
437
|
|
|
394
438
|
const { upload, uploadAvatar, isUploading, progress } = useStorage()
|
|
395
439
|
|
|
396
|
-
const url = await upload(file, {
|
|
440
|
+
const url = await upload(file, { folder: 'documents' })
|
|
397
441
|
const avatarUrl = await uploadAvatar(imageFile)
|
|
398
442
|
```
|
|
399
443
|
|