@onlyworlds/sdk 4.139.0 → 4.140.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/CHANGELOG.md CHANGED
@@ -5,6 +5,18 @@ earlier history lives in git log only.
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.140.0] - 2026-11-10
9
+
10
+ ### Added
11
+
12
+ - `OwAiUse.rating_need`: the rating tokens a call to the use needs left today to run, the output cap or the use's worst case when it is larger. `provider` names `anthropic` or `jev`.
13
+ - `err.isAnswerNotParsed`: 422 `answer_not_parsed` (param `answer`), a use whose model answered off its promised shape twice; billed to the use's own budget, not the token rating.
14
+ - `ai()`'s notes: a refusal the provider billed (`answer_not_parsed`, or a 502 after a billed answer) is kept under the idempotency key and replayed like an answer.
15
+
16
+ ### Tests
17
+
18
+ - A layout-only bundle (`trailByPlace`, `mapSpace`) carries none of the zip library, with `readWorldFile` as the control.
19
+
8
20
  ## [4.139.0] - 2026-11-10
9
21
 
10
22
  ### Deprecated
package/dist/index.d.ts CHANGED
@@ -3137,7 +3137,9 @@ interface OwAiUse {
3137
3137
  slug: string;
3138
3138
  /** The tool that answers for its prompt and caps. */
3139
3139
  owner: string;
3140
- provider: string;
3140
+ /** Who runs the model: `anthropic` (the platform's key, or the account's own saved key once its rating is
3141
+ * spent) or `jev` (a decisions gateway; an own key never runs it). */
3142
+ provider: 'anthropic' | 'jev' | (string & {});
3141
3143
  /** The model a call on the platform's key runs. */
3142
3144
  model: string;
3143
3145
  effort: string;
@@ -3147,8 +3149,11 @@ interface OwAiUse {
3147
3149
  needs_world: boolean;
3148
3150
  /** What the body may hold, by name. */
3149
3151
  input_caps: Record<string, number>;
3150
- /** The most tokens one answer may take; a call needs at least this much rating left (or a saved own key). */
3152
+ /** The most tokens one answer may take. */
3151
3153
  output_cap: number;
3154
+ /** The rating tokens a call needs left today to run (or a saved own key, for a use it can run): the
3155
+ * output cap, or the use's worst case when it is larger. */
3156
+ rating_need: number;
3152
3157
  /** The answer is checked JSON, not text. */
3153
3158
  structured: boolean;
3154
3159
  /** A fixed price per call in rating tokens, or null: the call's actual tokens are spent. */
@@ -4245,6 +4250,13 @@ declare class OwApiError extends Error {
4245
4250
  * but `aiUses()`, its uses and its own revoke, or a hosted MCP client's token anywhere but /mcp.
4246
4251
  */
4247
4252
  get isWrongAudience(): boolean;
4253
+ /**
4254
+ * ai: the use's model answered, but not in the shape the use promises, and asked again gave no usable
4255
+ * answer either (422 `answer_not_parsed`, param `answer`). The provider billed it to the use's own budget,
4256
+ * not the token rating; under an idempotency key the same refusal is replayed. Fall back to the tool's
4257
+ * own answer, and do not retry.
4258
+ */
4259
+ get isAnswerNotParsed(): boolean;
4248
4260
  /** ask: the model gave no answer (502 `ask_failed`). Not counted; try again in a moment. */
4249
4261
  get isAskFailed(): boolean;
4250
4262
  /**
@@ -5488,16 +5500,19 @@ declare class OwV2Client {
5488
5500
  * a key whose first call is still running is 409 `idempotency_in_flight` (retry after `retryAfter`).
5489
5501
  * Retry with the same key and body, a few times at most, and never mint a new key to get past an
5490
5502
  * in-flight answer: when the server cannot store an answer, the key is held for a day and keeps
5491
- * answering `idempotency_in_flight` although the call ran and was billed. The client never retries
5492
- * on its own.
5503
+ * answering `idempotency_in_flight` although the call ran and was billed. A refusal the provider
5504
+ * billed (422 `answer_not_parsed`, or a 502 after a billed answer) is kept under the key and replayed
5505
+ * like an answer, so a retry never bills it twice. The client never retries on its own.
5493
5506
  *
5494
- * Refusals, none of them counted: 429 `use_ceiling` (`err.isUseCeiling`: the use's calls for the day
5507
+ * Refusals, none of them counted against the rating: 429 `use_ceiling` (`err.isUseCeiling`: the use's calls for the day
5495
5508
  * are made), 429 `use_in_flight` (`err.isUseInFlight`: another call to this use is running; wait
5496
5509
  * `retryAfter`), 429 `quota_exceeded` (`err.isQuotaExceeded`: the token rating is spent and no own key
5497
5510
  * is saved), 422 `own_key_refused` (`err.isOwnKeyRefused`), 503 `ask_unavailable`
5498
5511
  * (`err.isAskUnavailable`; with `param` `use`, this use is switched off or spent its own budget
5499
5512
  * today), 502 `ask_failed` (`err.isAskFailed`), 404 `not_found` (a use that is not listed, `param`
5500
- * `use`, or a world the account is not in), 422 for a body past the use's limits (`param` names it).
5513
+ * `use`, or a world the account is not in), 422 for a body past the use's limits (`param` names it),
5514
+ * 422 `answer_not_parsed` (`err.isAnswerNotParsed`: the answer was off its shape twice; billed to the
5515
+ * use's own budget).
5501
5516
  */
5502
5517
  ai(use: 'ask', body: OwAiAskBody, opts?: {
5503
5518
  idempotencyKey?: string;
package/dist/index.js CHANGED
@@ -363,6 +363,15 @@ var OwApiError = class extends Error {
363
363
  get isWrongAudience() {
364
364
  return this.status === 401 && this.code === "wrong_audience";
365
365
  }
366
+ /**
367
+ * ai: the use's model answered, but not in the shape the use promises, and asked again gave no usable
368
+ * answer either (422 `answer_not_parsed`, param `answer`). The provider billed it to the use's own budget,
369
+ * not the token rating; under an idempotency key the same refusal is replayed. Fall back to the tool's
370
+ * own answer, and do not retry.
371
+ */
372
+ get isAnswerNotParsed() {
373
+ return this.status === 422 && this.code === "answer_not_parsed";
374
+ }
366
375
  /** ask: the model gave no answer (502 `ask_failed`). Not counted; try again in a moment. */
367
376
  get isAskFailed() {
368
377
  return this.status === 502 && this.code === "ask_failed";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "4.139.0",
3
+ "version": "4.140.0",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "type": "module",
6
6
  "exports": {