@aiqa/sdk 2.0.0 → 2.0.1

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
@@ -165,7 +165,7 @@ while you wait.
165
165
 
166
166
  `addFact()` does not throw on verification failure — an unmatched
167
167
  fact resolves with `is_valid_answer: false` and (where the backend
168
- provides it) `verification_status: "unmatched"` or `"contradicted"`.
168
+ provides it) `verification_status: "unmatched"`.
169
169
  Reject paths are reserved for transport / protocol errors.
170
170
 
171
171
  **Parameters:**
@@ -212,8 +212,7 @@ const result = await sdk.addFact({
212
212
  });
213
213
 
214
214
  if (result.is_valid_answer) {
215
- // verification_status will be "matched" (or "contradicted" if the
216
- // customer explicitly contradicted the expected answer).
215
+ // verification_status will be "matched".
217
216
  console.log("matched:", result.ai_answer);
218
217
  } else {
219
218
  // verification_status will be "unmatched". matched_components /
@@ -366,13 +365,13 @@ processing
366
365
  (same, but for a held unmatched verdict)
367
366
  │
368
367
  ▼
369
- matched | unmatched | contradicted ← terminal
368
+ matched | unmatched ← terminal
370
369
  ```
371
370
 
372
371
  Rules for consumers:
373
372
 
374
373
  - **`addFact()` resolves only on a terminal state** (`matched`,
375
- `unmatched`, `contradicted`). Render progress from the
374
+ `unmatched`). Render progress from the
376
375
  `FACT_VERIFIED` event, render the final verdict from the Promise
377
376
  result.
378
377
  - **Treat unknown `verification_status` strings as `processing`.**
@@ -453,8 +452,8 @@ interface AddFactResult {
453
452
  answer_match_score?: number;
454
453
 
455
454
  /**
456
- * Top-level state at terminal resolution. Always one of `matched`,
457
- * `unmatched`, or `contradicted` because the `addFact()` Promise only
455
+ * Top-level state at terminal resolution. Always one of `matched`
456
+ * or `unmatched` because the `addFact()` Promise only
458
457
  * resolves on terminals. Optional during the rollout window for
459
458
  * backwards compatibility with older backends.
460
459
  */
@@ -484,8 +483,7 @@ type VerificationStatus =
484
483
  | "pending_confirmation_matched"
485
484
  | "pending_confirmation_unmatched"
486
485
  | "matched"
487
- | "unmatched"
488
- | "contradicted";
486
+ | "unmatched";
489
487
  ```
490
488
 
491
489
  The enum is additive: consumers that `switch` on this value MUST
@@ -100,16 +100,15 @@ type QuestionStatus = "searching" | "asked" | "not_asked";
100
100
  * - `pending_confirmation_matched` backend has a matching answer but is
101
101
  * holding a settling window for mid-answer
102
102
  * clarifications (e.g. spellings, "I mean…");
103
- * resolves to `matched`/`unmatched`/`contradicted`
103
+ * resolves to `matched`/`unmatched`
104
104
  * - `pending_confirmation_unmatched` same as above but the held verdict is
105
105
  * `unmatched`; UI can show "we heard X but it
106
106
  * doesn't match, waiting to confirm" instead
107
107
  * of a hard red verdict
108
108
  * - `matched` terminal: answer matched expected
109
109
  * - `unmatched` terminal: budget exhausted with no match
110
- * - `contradicted` terminal (future): customer contradicted expected
111
110
  */
112
- type VerificationStatus = "processing" | "awaiting_question" | "awaiting_answer" | "partial" | "pending_confirmation_matched" | "pending_confirmation_unmatched" | "matched" | "unmatched" | "contradicted";
111
+ type VerificationStatus = "processing" | "awaiting_question" | "awaiting_answer" | "partial" | "pending_confirmation_matched" | "pending_confirmation_unmatched" | "matched" | "unmatched";
113
112
  type ApplicationFact = ApplicationFactInput & {
114
113
  ai_answer?: any;
115
114
  question_status: QuestionStatus;
@@ -143,8 +142,8 @@ interface AddFactResult {
143
142
  answer_match_score?: number;
144
143
  metadata?: Record<string, string>;
145
144
  /**
146
- * Top-level state at terminal resolution. Always one of `matched`,
147
- * `unmatched`, or `contradicted` because the `addFact()` Promise only
145
+ * Top-level state at terminal resolution. Always one of `matched`
146
+ * or `unmatched` because the `addFact()` Promise only
148
147
  * resolves on terminals. Optional during the rollout window for
149
148
  * backwards compatibility with older backends.
150
149
  */
@@ -164,7 +163,7 @@ interface AddFactResult {
164
163
  * Fires on EVERY state transition the verification queue produces —
165
164
  * non-terminal (`partial`, `awaiting_question`, `awaiting_answer`,
166
165
  * `pending_confirmation_matched`, `pending_confirmation_unmatched`,
167
- * `processing`) AND terminal (`matched`, `unmatched`, `contradicted`).
166
+ * `processing`) AND terminal (`matched`, `unmatched`).
168
167
  *
169
168
  * Subscribe with:
170
169
  * sdk.on("FACT_VERIFIED", (payload: FactVerifiedPayload) => {...});
@@ -3397,7 +3397,7 @@ var compareVersions = (left, right) => {
3397
3397
  // package.json
3398
3398
  var package_default = {
3399
3399
  name: "@aiqa/sdk",
3400
- version: "2.0.0-develop.2",
3400
+ version: "2.1.0-develop.1",
3401
3401
  main: "dist/node/node.js",
3402
3402
  module: "dist/node/node.js",
3403
3403
  types: "dist/node/node.d.ts",
@@ -3613,7 +3613,14 @@ var AiQaSdk = class {
3613
3613
  const url2 = new URL(this.url);
3614
3614
  const socketOptions = {
3615
3615
  reconnectionDelayMax: 1e4,
3616
- path: url2.pathname
3616
+ path: url2.pathname,
3617
+ // WebSocket only, skipping engine.io's default HTTP long-polling phase.
3618
+ // Some embedders sit behind proxies/security gateways that duplicate the
3619
+ // polling GETs across a fleet; the concurrent polls violate engine.io's
3620
+ // one-inflight-poll-per-session rule and tear the session down, so every
3621
+ // poll then returns "Session ID unknown" (HTTP 400) and the client never
3622
+ // authenticates. A single WebSocket has no repeated requests to duplicate.
3623
+ transports: ["websocket"]
3617
3624
  };
3618
3625
  this.socket = lookup2(url2.origin, socketOptions);
3619
3626
  this.socket.on("connect", () => {