@pluno/product-agent-web 0.1.241 → 0.1.243

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.
@@ -1283,9 +1283,9 @@ class er {
1283
1283
  if (t) for (const [r, o] of Object.entries(i)) {
1284
1284
  if (!o.observe || this.observations.has(r)) continue;
1285
1285
  const a = new Ze({
1286
- activeIntervalMs: 15e3,
1287
- idleIntervalMs: 15e3,
1288
- maxFailureIntervalMs: 3e4,
1286
+ activeIntervalMs: 6e4,
1287
+ idleIntervalMs: 6e4,
1288
+ maxFailureIntervalMs: 6e4,
1289
1289
  isActiveTurn: () => !1,
1290
1290
  poll: async () => {
1291
1291
  for (; !this.disposed && Q(this.options) && this.observations.get(r)?.history === a; ) {
@@ -1298,9 +1298,9 @@ class er {
1298
1298
  }
1299
1299
  }
1300
1300
  }), c = new Ze({
1301
- activeIntervalMs: 3e3,
1302
- idleIntervalMs: 15e3,
1303
- maxFailureIntervalMs: 3e4,
1301
+ activeIntervalMs: 15e3,
1302
+ idleIntervalMs: 6e4,
1303
+ maxFailureIntervalMs: 6e4,
1304
1304
  isActiveTurn: () => {
1305
1305
  const u = e.engine.getState().slices.conversation;
1306
1306
  return !!u.sessions[r]?.preparation || ["thinking", "steering", "queued", "stopping"].includes(u.sessions[r]?.execution?.phase ?? "idle") || Object.values(u.submissions).some((l) => l.sessionId === r && !l.cancelled && !["accepted", "failed"].includes(l.delivery));
@@ -1632,7 +1632,7 @@ function ar(s) {
1632
1632
  return e() && i.directory.memberships[t]?.members.length ? i.conversation.sessions[t] ?? null : null;
1633
1633
  }, s.invalidateAuth), async (t) => (!e() || t.authorityId !== s.authority.authorityId || t.generation !== s.authority.generation || !s.runtime().engine.getState().slices.directory.memberships[t.sessionId]?.members.length || (s.manager.receiveConversationSources(t.sources), s.notify()), null);
1634
1634
  }
1635
- const cr = "0.1.241", dr = {
1635
+ const cr = "0.1.243", dr = {
1636
1636
  version: cr
1637
1637
  };
1638
1638
  function et(s) {
@@ -4455,17 +4455,17 @@ class Xi {
4455
4455
  h.signal.aborted || (p.trigger = b, h.abort());
4456
4456
  }, f = () => m("transport_disposed"), y = () => m(["owner_disposed", "authority_retired", "observation_released", "request_replaced"].includes(o?.reason) ? o.reason : "caller_cancelled");
4457
4457
  this.requests.signal.addEventListener("abort", f, { once: !0 }), o?.addEventListener("abort", y, { once: !0 });
4458
- const v = setTimeout(() => m("deadline"), 15e3), S = r === "conversations" && /^\/[^/]+\/snapshot$/.test(e) && n === "POST", A = ho(), _ = Date.now();
4458
+ const v = r === "conversations" && /^\/[^/]+\/snapshot$/.test(e) && n === "POST", S = setTimeout(() => m("deadline"), v ? 3e4 : 15e3), A = ho(), _ = Date.now();
4459
4459
  let I = null, R = null, q = null, V = null;
4460
4460
  try {
4461
4461
  const b = await Promise.resolve(fetch(l, {
4462
4462
  method: n ?? (i === void 0 ? "GET" : "POST"),
4463
4463
  cache: "no-store",
4464
4464
  signal: h.signal,
4465
- headers: { "x-product-agent-auth-request-id": A, authorization: u || r === "conversations" ? `Bearer ${this.auth.token}` : this.auth.token, "content-type": "application/json", ...S ? { "x-request-id": A } : {} },
4465
+ headers: { "x-product-agent-auth-request-id": A, authorization: u || r === "conversations" ? `Bearer ${this.auth.token}` : this.auth.token, "content-type": "application/json", ...v ? { "x-request-id": A } : {} },
4466
4466
  ...i === void 0 ? {} : { body: JSON.stringify(i) }
4467
4467
  })).catch((C) => {
4468
- throw S && C instanceof TypeError ? new w("The connection was interrupted. Please try again.", "connection_interrupted", !0) : C;
4468
+ throw v && C instanceof TypeError ? new w("The connection was interrupted. Please try again.", "connection_interrupted", !0) : C;
4469
4469
  });
4470
4470
  if (I = Date.now(), R = b.status, q = ei(b.headers.get("x-request-id")), V = ei(b.headers.get("x-cloud-trace-context")), !b.ok) {
4471
4471
  const C = b.status === 401 ? "unauthorized" : b.status === 426 ? "update_required" : String(b.status), T = (await b.json().catch(() => null))?.detail;
@@ -4486,7 +4486,7 @@ class Xi {
4486
4486
  const C = p.trigger ?? ((b instanceof Error || b instanceof DOMException) && b.name === "AbortError" ? "unexpected_abort" : null), T = {
4487
4487
  requestId: A,
4488
4488
  method: n ?? (i === void 0 ? "GET" : "POST"),
4489
- route: S ? "/api/product-agent/conversations/:sessionId/snapshot" : e === "/commands" ? "/api/product-agent/:namespace/commands" : "/api/product-agent/:namespace/:operation",
4489
+ route: v ? "/api/product-agent/conversations/:sessionId/snapshot" : e === "/commands" ? "/api/product-agent/:namespace/commands" : "/api/product-agent/:namespace/:operation",
4490
4490
  status: R,
4491
4491
  abortTrigger: C,
4492
4492
  category: C === "deadline" ? "request_timed_out" : C === "unexpected_abort" ? "connection_interrupted" : C ? "request_cancelled" : b instanceof w ? b.code : "invalid_response",
@@ -4515,14 +4515,14 @@ class Xi {
4515
4515
  z
4516
4516
  );
4517
4517
  }
4518
- throw b instanceof w && z ? new w(b.message, b.code, b.outcomeUnknown, { ...b.detail, ...z }, b.backendRefusal) : S && z ? new w(
4518
+ throw b instanceof w && z ? new w(b.message, b.code, b.outcomeUnknown, { ...b.detail, ...z }, b.backendRefusal) : v && z ? new w(
4519
4519
  "The conversation response could not be read. Please try again.",
4520
4520
  "connection_interrupted",
4521
4521
  !0,
4522
4522
  z
4523
4523
  ) : b;
4524
4524
  } finally {
4525
- clearTimeout(v), this.requests.signal.removeEventListener("abort", f), o?.removeEventListener("abort", y);
4525
+ clearTimeout(S), this.requests.signal.removeEventListener("abort", f), o?.removeEventListener("abort", y);
4526
4526
  }
4527
4527
  }
4528
4528
  }
@@ -1406,9 +1406,9 @@ class Sp {
1406
1406
  if (n) for (const [o, a] of Object.entries(i)) {
1407
1407
  if (!a.observe || this.observations.has(o)) continue;
1408
1408
  const r = new hs({
1409
- activeIntervalMs: 15e3,
1410
- idleIntervalMs: 15e3,
1411
- maxFailureIntervalMs: 3e4,
1409
+ activeIntervalMs: 6e4,
1410
+ idleIntervalMs: 6e4,
1411
+ maxFailureIntervalMs: 6e4,
1412
1412
  isActiveTurn: () => !1,
1413
1413
  poll: async () => {
1414
1414
  for (; !this.disposed && ot(this.options) && this.observations.get(o)?.history === r; ) {
@@ -1421,9 +1421,9 @@ class Sp {
1421
1421
  }
1422
1422
  }
1423
1423
  }), c = new hs({
1424
- activeIntervalMs: 3e3,
1425
- idleIntervalMs: 15e3,
1426
- maxFailureIntervalMs: 3e4,
1424
+ activeIntervalMs: 15e3,
1425
+ idleIntervalMs: 6e4,
1426
+ maxFailureIntervalMs: 6e4,
1427
1427
  isActiveTurn: () => {
1428
1428
  const u = e.engine.getState().slices.conversation;
1429
1429
  return !!u.sessions[o]?.preparation || ["thinking", "steering", "queued", "stopping"].includes(u.sessions[o]?.execution?.phase ?? "idle") || Object.values(u.submissions).some((p) => p.sessionId === o && !p.cancelled && !["accepted", "failed"].includes(p.delivery));
@@ -1820,7 +1820,7 @@ function Op(t) {
1820
1820
  return e() && i.directory.memberships[n]?.members.length ? i.conversation.sessions[n] ?? null : null;
1821
1821
  }, t.invalidateAuth), async (n) => (!e() || n.authorityId !== t.authority.authorityId || n.generation !== t.authority.generation || !t.runtime().engine.getState().slices.directory.memberships[n.sessionId]?.members.length || (t.manager.receiveConversationSources(n.sources), t.notify()), null);
1822
1822
  }
1823
- const Ql = "0.1.241", Np = {
1823
+ const Ql = "0.1.243", Np = {
1824
1824
  version: Ql
1825
1825
  }, Tt = /* @__PURE__ */ Object.create(null);
1826
1826
  Tt.open = "0";
@@ -4509,17 +4509,17 @@ class pd {
4509
4509
  h.signal.aborted || (g.trigger = C, h.abort());
4510
4510
  }, f = () => y("transport_disposed"), w = () => y(["owner_disposed", "authority_retired", "observation_released", "request_replaced"].includes(a?.reason) ? a.reason : "caller_cancelled");
4511
4511
  this.requests.signal.addEventListener("abort", f, { once: !0 }), a?.addEventListener("abort", w, { once: !0 });
4512
- const b = setTimeout(() => y("deadline"), 15e3), _ = o === "conversations" && /^\/[^/]+\/snapshot$/.test(e) && s === "POST", T = Dh(), x = Date.now();
4512
+ const b = o === "conversations" && /^\/[^/]+\/snapshot$/.test(e) && s === "POST", _ = setTimeout(() => y("deadline"), b ? 3e4 : 15e3), T = Dh(), x = Date.now();
4513
4513
  let A = null, q = null, D = null, Q = null;
4514
4514
  try {
4515
4515
  const C = await Promise.resolve(fetch(p, {
4516
4516
  method: s ?? (i === void 0 ? "GET" : "POST"),
4517
4517
  cache: "no-store",
4518
4518
  signal: h.signal,
4519
- headers: { "x-product-agent-auth-request-id": T, authorization: u || o === "conversations" ? `Bearer ${this.auth.token}` : this.auth.token, "content-type": "application/json", ..._ ? { "x-request-id": T } : {} },
4519
+ headers: { "x-product-agent-auth-request-id": T, authorization: u || o === "conversations" ? `Bearer ${this.auth.token}` : this.auth.token, "content-type": "application/json", ...b ? { "x-request-id": T } : {} },
4520
4520
  ...i === void 0 ? {} : { body: JSON.stringify(i) }
4521
4521
  })).catch((B) => {
4522
- throw _ && B instanceof TypeError ? new O("The connection was interrupted. Please try again.", "connection_interrupted", !0) : B;
4522
+ throw b && B instanceof TypeError ? new O("The connection was interrupted. Please try again.", "connection_interrupted", !0) : B;
4523
4523
  });
4524
4524
  if (A = Date.now(), q = C.status, D = Ec(C.headers.get("x-request-id")), Q = Ec(C.headers.get("x-cloud-trace-context")), !C.ok) {
4525
4525
  const B = C.status === 401 ? "unauthorized" : C.status === 426 ? "update_required" : String(C.status), z = (await C.json().catch(() => null))?.detail;
@@ -4540,7 +4540,7 @@ class pd {
4540
4540
  const B = g.trigger ?? ((C instanceof Error || C instanceof DOMException) && C.name === "AbortError" ? "unexpected_abort" : null), z = {
4541
4541
  requestId: T,
4542
4542
  method: s ?? (i === void 0 ? "GET" : "POST"),
4543
- route: _ ? "/api/product-agent/conversations/:sessionId/snapshot" : e === "/commands" ? "/api/product-agent/:namespace/commands" : "/api/product-agent/:namespace/:operation",
4543
+ route: b ? "/api/product-agent/conversations/:sessionId/snapshot" : e === "/commands" ? "/api/product-agent/:namespace/commands" : "/api/product-agent/:namespace/:operation",
4544
4544
  status: q,
4545
4545
  abortTrigger: B,
4546
4546
  category: B === "deadline" ? "request_timed_out" : B === "unexpected_abort" ? "connection_interrupted" : B ? "request_cancelled" : C instanceof O ? C.code : "invalid_response",
@@ -4569,14 +4569,14 @@ class pd {
4569
4569
  ee
4570
4570
  );
4571
4571
  }
4572
- throw C instanceof O && ee ? new O(C.message, C.code, C.outcomeUnknown, { ...C.detail, ...ee }, C.backendRefusal) : _ && ee ? new O(
4572
+ throw C instanceof O && ee ? new O(C.message, C.code, C.outcomeUnknown, { ...C.detail, ...ee }, C.backendRefusal) : b && ee ? new O(
4573
4573
  "The conversation response could not be read. Please try again.",
4574
4574
  "connection_interrupted",
4575
4575
  !0,
4576
4576
  ee
4577
4577
  ) : C;
4578
4578
  } finally {
4579
- clearTimeout(b), this.requests.signal.removeEventListener("abort", f), a?.removeEventListener("abort", w);
4579
+ clearTimeout(_), this.requests.signal.removeEventListener("abort", f), a?.removeEventListener("abort", w);
4580
4580
  }
4581
4581
  }
4582
4582
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluno/product-agent-web",
3
- "version": "0.1.241",
3
+ "version": "0.1.243",
4
4
  "description": "Browser SDK and default widget for embedding Pluno Product Agent into customer web apps.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",