wontopos 2.2.31 → 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.
@@ -148,9 +148,24 @@ export interface StatusResult {
148
148
  /**
149
149
  * An image attached to a memory, passed to `add`/`store` via `opts.image`.
150
150
  *
151
- * The bytes are used ONCE, to embed the image, and are not kept. If you want the
152
- * original back later, either let the service keep it (then `getImage` returns it) or
153
- * put your own URL in `reference` — we store that string and never open it.
151
+ * What the service keeps is NOT your original. An image whose long edge is over
152
+ * 1568px is downscaled to 1568 before anything else happens, and that smaller
153
+ * picture is what gets embedded, stored, and handed back by `getImage`. Nothing in
154
+ * the retrieval path ever looks above 1568 — the embedder and the reader both
155
+ * shrink to it — so the extra pixels would be bytes nobody reads. This is a memory
156
+ * service, not a photo host: the picture it holds has the resolution of a memory.
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
+ *
165
+ * Keep your own copy if you need the full-resolution file. Either archive it
166
+ * yourself, or put its URL in `reference` — we store that string and never open it.
167
+ *
168
+ * You are billed for the picture we keep, so downscaling never costs you more.
154
169
  */
155
170
  export interface ImageInput {
156
171
  /** base64 of the image. A `data:image/...;base64,` prefix is accepted and stripped. */
@@ -166,9 +181,15 @@ export interface ImageInput {
166
181
  */
167
182
  taken_at?: string;
168
183
  }
169
- /** `getImage` → the original bytes plus what they actually are. */
184
+ /** `getImage` → the picture the service holds, plus what it actually is. */
170
185
  export interface ImageBytes {
171
- /** The raw image. Write it to a file, or wrap it in a Blob to show it. */
186
+ /**
187
+ * The image as stored. Write it to a file, or wrap it in a Blob to show it.
188
+ *
189
+ * This is the service's copy, not necessarily your upload: anything over 1568px
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`.
192
+ */
172
193
  bytes: Uint8Array;
173
194
  /** Sniffed from the BYTES, not from whatever the upload was named — e.g. `image/jpeg`. */
174
195
  contentType: string;
@@ -650,16 +671,26 @@ export declare class Client {
650
671
  /** Collect ALL of a store's memories into an array (original text + metadata, no vectors). */
651
672
  exportMemories(userId?: string): Promise<Memory[]>;
652
673
  /**
653
- * Fetch the ORIGINAL bytes of an image memory.
654
- *
655
- * Returns what was uploaded, with the type sniffed from the bytes themselves rather
656
- * than from whatever the file was called. Rejects with `NotFoundError` when this
657
- * memory has no image, or when the service was not configured to keep originals —
658
- * it says "no" instead of handing back something empty, so "a memory with no image"
659
- * never looks the same as "an image we lost".
674
+ * Fetch the bytes of an image memory — the picture the SERVICE holds.
675
+ *
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".
660
690
  *
661
691
  * const { bytes, contentType } = await mem.getImage(undefined, id);
662
- * await fs.writeFile("image.jpg", bytes);
692
+ * const ext = contentType.split("/")[1]; // "webp" for a downscaled PNG
693
+ * await fs.writeFile(`image.${ext}`, bytes);
663
694
  */
664
695
  getImage(userId: string | undefined, memoryId: string): Promise<ImageBytes>;
665
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.31";
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). */
@@ -689,16 +689,26 @@ export class Client {
689
689
  }
690
690
  // ----- images (Tablet 2 and newer) -----
691
691
  /**
692
- * Fetch the ORIGINAL bytes of an image memory.
692
+ * Fetch the bytes of an image memory — the picture the SERVICE holds.
693
693
  *
694
- * Returns what was uploaded, with the type sniffed from the bytes themselves rather
695
- * than from whatever the file was called. Rejects with `NotFoundError` when this
696
- * memory has no image, or when the service was not configured to keep originals —
697
- * it says "no" instead of handing back something empty, so "a memory with no image"
698
- * 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".
699
708
  *
700
709
  * const { bytes, contentType } = await mem.getImage(undefined, id);
701
- * await fs.writeFile("image.jpg", bytes);
710
+ * const ext = contentType.split("/")[1]; // "webp" for a downscaled PNG
711
+ * await fs.writeFile(`image.${ext}`, bytes);
702
712
  */
703
713
  getImage(userId, memoryId) {
704
714
  if (!memoryId || typeof memoryId !== "string") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wontopos",
3
- "version": "2.2.31",
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",