@moss-dev/moss-web 1.11.1 → 1.12.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 CHANGED
@@ -18,7 +18,7 @@ Built on WebAssembly for near-native performance in any modern browser.
18
18
  npm install @moss-dev/moss-web
19
19
  ```
20
20
 
21
- Version 1.11.1 resolves `@moss-dev/moss-wasm@0.19.1`. Text `query()` loads its
21
+ Version 1.12.0 resolves `@moss-dev/moss-wasm@0.20.0`. Text `query()` loads its
22
22
  model through the Moss service using the client's credentials, so the service
23
23
  must be reachable the first time a model is loaded; there is no offline
24
24
  fallback. Before 1.2.0 the only published npm versions were 1.0.0 and 1.0.1,
@@ -514,6 +514,19 @@ for (const file of (await client.tasks.files.list(done.id)).data) {
514
514
  }
515
515
  ```
516
516
 
517
+ A task created with `zero_data_retention: true` keeps its content only while
518
+ it runs and for about an hour after it ends, its `content_expires_at`, so
519
+ `wait` or `retrieve` can collect the answer. Then the gateway blanks it:
520
+ `goal` becomes empty, `output_schema`, `metadata`, `result` and
521
+ `verification` become null, `error` keeps its `code` with an empty `message`,
522
+ and `content_deleted_at` says when. `retrieve` keeps answering with the id,
523
+ status, times, model, limits and usage. The gateway stores no trace,
524
+ screenshots or files for such a task: `trace`, `files.list` and
525
+ `files.content` reject with a 410 `zero_data_retention`, and
526
+ `files_expire_at` is null. Only an organization on the enterprise plan may
527
+ ask: elsewhere the create rejects with a 400 `zero_data_retention_not_enabled`,
528
+ while false or nothing is fine anywhere.
529
+
517
530
  Each call takes the options of `responses.create`, and retries as it does, but
518
531
  never after a 409. `create` and `run` also take `apiKey`, and send only that
519
532
  call's key as `X-Moss-Provider-Key`, for the task's model calls; see the pricing
@@ -535,10 +548,12 @@ the visitor started the task they read or cancel.
535
548
  | --- | --- | --- | --- |
536
549
  | 400 | `invalid_request_error` | `invalid_request_error` | A field or value the gateway refuses |
537
550
  | 400 | `invalid_request_error` | `model_not_found` | A model the gateway does not serve |
551
+ | 400 | `invalid_request_error` | `zero_data_retention_not_enabled` | `zero_data_retention: true` for an organization that is not on the enterprise plan |
538
552
  | 403 | `permission_error` | `tasks_not_enabled` | Tasks are not enabled for the project |
539
553
  | 404 | `not_found_error` | `not_found_error` | No such task in the project, no trace yet, or no such file |
540
554
  | 409 | `invalid_request_error` | `task_not_finished` | The files of a task that is still queued or running |
541
555
  | 410 | `invalid_request_error` | `files_expired` | The trace or files after the task's `files_expire_at` |
556
+ | 410 | `invalid_request_error` | `zero_data_retention` | The trace or files of a task created with `zero_data_retention` |
542
557
  | 422 | `invalid_request_error` | `idempotency_key_reused` | An `Idempotency-Key` sent again with another body |
543
558
  | 429 | `rate_limit_error` | `too_many_queued_tasks` | Too many queued tasks; retry after `retryAfter` |
544
559
  | 503 | `server_error` | `server_error` | Tasks are not enabled on the gateway |
@@ -18,7 +18,8 @@ export interface Responses {
18
18
  * The files of a task, under `tasks.files`, ready once the task ends.
19
19
  * While it is queued or running they reject with a 409 `task_not_finished`, never retried.
20
20
  * The gateway removes them 7 days after the task ends, at its `files_expire_at`,
21
- * and from then on they reject with a 410 `files_expired`.
21
+ * and from then on they reject with a 410 `files_expired`. A task created with
22
+ * `zero_data_retention` has none: they reject with a 410 `zero_data_retention`.
22
23
  */
23
24
  export interface TaskFiles {
24
25
  /** Lists the screenshots and output files of a task. */
@@ -73,6 +74,8 @@ export interface Tasks {
73
74
  * It rejects with `not_found_error` until `trace_available` is true.
74
75
  * The gateway removes it 7 days after the task ends, at `files_expire_at`,
75
76
  * and from then on it rejects with a 410 `files_expired`.
77
+ * A task created with `zero_data_retention` has no trace: it rejects with a 410
78
+ * `zero_data_retention`.
76
79
  */
77
80
  trace(taskId: string, options?: TaskRequestOptions): Promise<unknown>;
78
81
  readonly files: TaskFiles;
@@ -328,6 +328,14 @@ export interface TaskCreateParams {
328
328
  effort?: "low" | "medium" | "high";
329
329
  /** Your own data, sent back with the task. */
330
330
  metadata?: Record<string, unknown>;
331
+ /**
332
+ * True keeps the task's content only while it runs and for about an hour after it ends,
333
+ * so `wait` or `retrieve` can collect the answer, and stores no trace, screenshots or files.
334
+ * Then the gateway blanks the content; see `content_deleted_at` on {@link Task}.
335
+ * Only an organization on the enterprise plan may ask: elsewhere the create rejects
336
+ * with a 400 `zero_data_retention_not_enabled`, while false or nothing is fine anywhere.
337
+ */
338
+ zero_data_retention?: boolean;
331
339
  }
332
340
  /** The state of a task. It ends `completed`, `failed` or `cancelled`. */
333
341
  export type TaskStatus = "queued" | "running" | "completed" | "failed" | "cancelled" | (string & {});
@@ -393,8 +401,25 @@ export interface Task<Output = unknown> {
393
401
  created_at: string;
394
402
  started_at: string | null;
395
403
  finished_at: string | null;
396
- /** When the gateway removes the trace and files, 7 days after the task ends. Null before. */
404
+ /**
405
+ * When the gateway removes the trace and files, 7 days after the task ends. Null before,
406
+ * and always for a task with `zero_data_retention`, which has none.
407
+ */
397
408
  files_expire_at: string | null;
409
+ /** True for a task created with `zero_data_retention`. */
410
+ zero_data_retention?: boolean;
411
+ /**
412
+ * When the gateway blanks the content of a task with `zero_data_retention`,
413
+ * about an hour after it ends. Null before it ends, and for other tasks.
414
+ */
415
+ content_expires_at?: string | null;
416
+ /**
417
+ * When the gateway blanked the content. Null while the content is there. Blanked, `goal`
418
+ * is empty, `output_schema`, `metadata`, `result` and `verification` are null, `error`
419
+ * keeps its `code` with an empty `message`, and the id, status, times, model, limits
420
+ * and usage stay.
421
+ */
422
+ content_deleted_at?: string | null;
398
423
  [key: string]: any;
399
424
  }
400
425
  /** A file of a task, such as a screenshot. */
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@moss-dev/moss-web",
3
- "version": "1.11.1",
3
+ "version": "1.12.0",
4
4
  "type": "module",
5
5
  "description": "Moss browser SDK — in-browser semantic search powered by WASM",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
9
  "sideEffects": false,
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/usemoss/moss-sdks-internal.git"
13
+ },
10
14
  "exports": {
11
15
  ".": {
12
16
  "types": "./dist/index.d.ts",
@@ -32,7 +36,7 @@
32
36
  "test": "npm run build && node --test"
33
37
  },
34
38
  "dependencies": {
35
- "@moss-dev/moss-wasm": "0.19.1",
39
+ "@moss-dev/moss-wasm": "0.20.0",
36
40
  "onnxruntime-web": "1.30.0"
37
41
  },
38
42
  "devDependencies": {