wontopos 2.2.32 → 2.2.33

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.
@@ -155,6 +155,13 @@ export interface StatusResult {
155
155
  * shrink to it — so the extra pixels would be bytes nobody reads. This is a memory
156
156
  * service, not a photo host: the picture it holds has the resolution of a memory.
157
157
  *
158
+ * It can also come back in a different FORMAT. Downscaling means re-encoding, and
159
+ * we write lossless formats as WebP — send a PNG or a GIF over 1568px and `getImage`
160
+ * hands back `image/webp`; JPEG stays JPEG. So do not name the file from the
161
+ * extension you uploaded: read `contentType`. Nothing is re-encoded when the image
162
+ * already fits within 1568px, and a re-encode that would make the file BIGGER is
163
+ * thrown away and your bytes kept as they were.
164
+ *
158
165
  * Keep your own copy if you need the full-resolution file. Either archive it
159
166
  * yourself, or put its URL in `reference` — we store that string and never open it.
160
167
  *
@@ -180,7 +187,8 @@ export interface ImageBytes {
180
187
  * The image as stored. Write it to a file, or wrap it in a Blob to show it.
181
188
  *
182
189
  * This is the service's copy, not necessarily your upload: anything over 1568px
183
- * on its long edge was downscaled on the way in (see `ImageInput`).
190
+ * on its long edge was downscaled on the way in, and re-encoded to WebP unless it
191
+ * was a JPEG (see `ImageInput`). Take the file extension from `contentType`.
184
192
  */
185
193
  bytes: Uint8Array;
186
194
  /** Sniffed from the BYTES, not from whatever the upload was named — e.g. `image/jpeg`. */
@@ -665,18 +673,24 @@ export declare class Client {
665
673
  /**
666
674
  * Fetch the bytes of an image memory — the picture the SERVICE holds.
667
675
  *
668
- * Not necessarily your upload: an image whose long edge was over 1568px was
669
- * downscaled to 1568 on the way in, and that is what was embedded, stored and
670
- * comes back here. Nothing in the retrieval path looks above 1568, so the extra
671
- * pixels would be bytes nobody reads. Keep your own copy for the full-resolution
672
- * file. The type is sniffed from the bytes themselves rather
673
- * than from whatever the file was called. Rejects with `NotFoundError` when this
674
- * memory has no image, or when the service was not configured to keep originals —
675
- * it says "no" instead of handing back something empty, so "a memory with no image"
676
- * never looks the same as "an image we lost".
676
+ * Not necessarily your upload, in size OR in format: an image whose long edge was
677
+ * over 1568px was downscaled to 1568 on the way in and re-encoded — lossless
678
+ * formats as WebP, so a PNG comes back as `image/webp`; JPEG stays JPEG — and that
679
+ * smaller picture is what was embedded, stored and comes back here. Nothing in the
680
+ * retrieval path looks above 1568, so the extra pixels would be bytes nobody reads.
681
+ * Keep your own copy for the full-resolution file.
682
+ *
683
+ * The type is sniffed from the bytes themselves rather than from whatever the file
684
+ * was called, so name the file from `contentType` rather than from what you sent.
685
+ * When the format changed, the response also carries `x-wos-image-converted-from`
686
+ * naming what you uploaded. Rejects with `NotFoundError` when this memory has no
687
+ * image, or when the service keeps no image bytes at all — it says "no" instead of
688
+ * handing back something empty, so "a memory with no image" never looks the same as
689
+ * "an image we lost".
677
690
  *
678
691
  * const { bytes, contentType } = await mem.getImage(undefined, id);
679
- * await fs.writeFile("image.jpg", bytes);
692
+ * const ext = contentType.split("/")[1]; // "webp" for a downscaled PNG
693
+ * await fs.writeFile(`image.${ext}`, bytes);
680
694
  */
681
695
  getImage(userId: string | undefined, memoryId: string): Promise<ImageBytes>;
682
696
  /**
package/dist/wontopos.js CHANGED
@@ -37,7 +37,7 @@
37
37
  * runtime's (never disabled by this SDK; Node 18+ floors TLS at 1.2). Prefer
38
38
  * `Client.fromEnv()` over keys in source code.
39
39
  */
40
- const VERSION = "2.2.32";
40
+ const VERSION = "2.2.33";
41
41
  /** Runtime info helps support debug a report ("node 18 on Windows...") —
42
42
  * platform only, never anything identifying. Browsers have no `process` (and
43
43
  * silently drop the UA header anyway). */
@@ -691,18 +691,24 @@ export class Client {
691
691
  /**
692
692
  * Fetch the bytes of an image memory — the picture the SERVICE holds.
693
693
  *
694
- * Not necessarily your upload: an image whose long edge was over 1568px was
695
- * downscaled to 1568 on the way in, and that is what was embedded, stored and
696
- * comes back here. Nothing in the retrieval path looks above 1568, so the extra
697
- * pixels would be bytes nobody reads. Keep your own copy for the full-resolution
698
- * file. The type is sniffed from the bytes themselves rather
699
- * than from whatever the file was called. Rejects with `NotFoundError` when this
700
- * memory has no image, or when the service was not configured to keep originals —
701
- * it says "no" instead of handing back something empty, so "a memory with no image"
702
- * never looks the same as "an image we lost".
694
+ * Not necessarily your upload, in size OR in format: an image whose long edge was
695
+ * over 1568px was downscaled to 1568 on the way in and re-encoded — lossless
696
+ * formats as WebP, so a PNG comes back as `image/webp`; JPEG stays JPEG — and that
697
+ * smaller picture is what was embedded, stored and comes back here. Nothing in the
698
+ * retrieval path looks above 1568, so the extra pixels would be bytes nobody reads.
699
+ * Keep your own copy for the full-resolution file.
700
+ *
701
+ * The type is sniffed from the bytes themselves rather than from whatever the file
702
+ * was called, so name the file from `contentType` rather than from what you sent.
703
+ * When the format changed, the response also carries `x-wos-image-converted-from`
704
+ * naming what you uploaded. Rejects with `NotFoundError` when this memory has no
705
+ * image, or when the service keeps no image bytes at all — it says "no" instead of
706
+ * handing back something empty, so "a memory with no image" never looks the same as
707
+ * "an image we lost".
703
708
  *
704
709
  * const { bytes, contentType } = await mem.getImage(undefined, id);
705
- * await fs.writeFile("image.jpg", bytes);
710
+ * const ext = contentType.split("/")[1]; // "webp" for a downscaled PNG
711
+ * await fs.writeFile(`image.${ext}`, bytes);
706
712
  */
707
713
  getImage(userId, memoryId) {
708
714
  if (!memoryId || typeof memoryId !== "string") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wontopos",
3
- "version": "2.2.32",
3
+ "version": "2.2.33",
4
4
  "description": "Wontopos — long-term memory for AI agents. Pure semantic retrieval, identical recall in every language, ~100× lower LLM bill.",
5
5
  "keywords": [
6
6
  "memory",