wontopos 2.2.35 → 2.2.37

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
@@ -25,7 +25,7 @@ const ctx = await mem.recall("what does alice drink?", "alice");
25
25
 
26
26
  - **The same in every language** — identical recall whichever language a memory was written in (Korean · Japanese · Chinese · English).
27
27
  - **No LLM in the loop** — `store` / `search` / `recall` never call a language model. You pay retrieval, not generation.
28
- - **Bounded retrieval** — `recall()` returns a small, fixed-size slice (~1,200 tokens) regardless of how much you've stored.
28
+ - **Bounded retrieval** — `recall()` returns a small, fixed-size slice regardless of how much you've stored (~1,000 tokens on `tablet-2`, the default engine).
29
29
 
30
30
  ## Methods
31
31
 
@@ -89,7 +89,14 @@ Built in, no configuration needed:
89
89
  exponential backoff + jitter, honoring the server's `Retry-After`. Tune with
90
90
  `new Client({ maxRetries })`; `0` disables.
91
91
  - **Redirects refused** — the API key never follows a 3xx to another host.
92
- - **Timeouts** — 30s per attempt by default (`timeoutMs`).
92
+ - **Timeouts** — 30s per attempt by default (`timeoutMs`), and a total budget for
93
+ the whole call across every retry with `deadlineMs` / `withDeadline(ms)`. At the
94
+ defaults one call can hold for 30s + backoff + 30s + backoff + 30s, which a
95
+ request handler with five seconds cannot use.
96
+ - **Cancellable** — pass the caller's `AbortSignal` (`new Client({ signal })` or
97
+ `withSignal(signal)`). Aborting ends the request in flight and any backoff sleep
98
+ waiting to retry it.
99
+ - **CommonJS and ESM** — `require("wontopos")` and `import` both resolve.
93
100
  - **Key never in logs** — `JSON.stringify(client)` and Node's `console.log(client)`
94
101
  print a masked key.
95
102
  - **Wipe guard** — `delete()` without a `memoryId` throws instead of silently
@@ -175,10 +182,13 @@ try {
175
182
  }
176
183
  ```
177
184
 
178
- ## Self-host
185
+ ## A different API host
186
+
187
+ Point the client somewhere other than the default endpoint - a dedicated region,
188
+ a proxy of your own, or a local test server:
179
189
 
180
190
  ```ts
181
- const mem = new Client({ apiKey: "...", baseUrl: "https://wos.your-host.com" });
191
+ const mem = new Client({ apiKey: "...", baseUrl: "https://api.example.com" });
182
192
  ```
183
193
 
184
194
  ## Links
@@ -207,6 +217,28 @@ default engine, and 2.2.35 gives `search` the count range `recall` has always ha
207
217
  rule you can bend without saying so is not a rule, so both are stated rather than left
208
218
  for a reader to hit.
209
219
 
220
+ - **2.2.36** — an outside review, read by a different model with no knowledge of why
221
+ any of this was written. The one that mattered: `recall()` promised in its own
222
+ documentation that a count outside 5–20 was refused rather than clamped, and
223
+ nothing checked — so `{ limit: 500 }` travelled to the service and failed there, for a
224
+ mistake visible before opening a socket. `context_limit` (0–20) was unchecked the same way.
225
+ Both are refused here now, and `0` still passes for `context_limit` because "attach none" is
226
+ an answer, not a missing value.
227
+ An argument mistake now throws a plain `Error`, not a `WosError`. A `WosError` with
228
+ status 0 is `APIConnectionError` — "the request never got a response" — so
229
+ `if (e.status === 0) retry()` would have retried a typo forever. And `recall` is
230
+ now `async`: validating inside a non-async method threw synchronously, so
231
+ `mem.recall(...).catch(h)` walked past the handler while the same mistake in
232
+ `search` landed in it.
233
+ New `deadlineMs` / `withDeadline(ms)`: a TOTAL budget for one call across every
234
+ retry. `timeoutMs` bounds one ATTEMPT, so at the defaults a call could hold for 30s
235
+ + backoff + 30s + backoff + 30s and a request handler with five seconds had no way
236
+ to say so. New `signal` / `withSignal(signal)`: cancel work in flight — an abort
237
+ ends the request AND any backoff sleep waiting to retry it.
238
+ `require("wontopos")` now resolves: the package ships CommonJS and ESM from one
239
+ source. Previously `"type": "module"` with no `require` condition meant Node's CJS
240
+ resolver could not resolve this package at all.
241
+ `replayed` is set only when the service did not send that field itself.
210
242
  - **2.2.35** — fixes, and **two behaviour changes**, both listed first because a patch
211
243
  release is not the place to find one by surprise.
212
244
 
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}