@vinaverse/client 0.1.0-alpha.5 → 0.1.0-alpha.6

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
@@ -125,7 +125,7 @@ History's "Continue" is `continue(key, conversationId)`: the key goes on with th
125
125
  is said as `ended` (your backend throws `AgentRefusal('ended', { code })` on a 404 or 410). A session must have an id
126
126
  and a secret, and `wss://` and `https://` addresses whatever transport you supply (a wrapper adding headers or logging
127
127
  still gets only secure ones). `insecureAddresses: { realtime, turns }` allows plaintext for one leg: dangerous, for mocks
128
- and local development only, and the runtime warns outside `__DEV__`.
128
+ and local development only, and the runtime warns outside `__DEV__` (through `onWarning`, your logger, else `console.warn`).
129
129
  A UI binding reads the key's conversation with `peek(key)`, which ends nothing (a render must not): one past its
130
130
  session's end is ended when it is next shown, and `subscribe` then tells the binding to read the next one.
131
131
 
@@ -2463,10 +2463,10 @@ var samePlace = (a, b) => a?.screen === b?.screen && (a?.entity?.type ?? null) =
2463
2463
  function usable(session, insecure) {
2464
2464
  return typeof session.id === "string" && session.id !== "" && (insecure.realtime === true || /^wss:\/\//i.test(session.realtime_url ?? "")) && (insecure.turns === true || /^https:\/\//i.test(session.turns_url ?? "")) && Boolean(session.client_secret);
2465
2465
  }
2466
- function warnInsecure(insecure) {
2466
+ function warnInsecure(insecure, warn) {
2467
2467
  if (!(insecure.realtime || insecure.turns)) return;
2468
2468
  if (globalThis.__DEV__ === true) return;
2469
- console.warn(
2469
+ warn(
2470
2470
  "@vinaverse/client/agent: insecureAddresses lets sessions use plaintext ws:// or http:// addresses. It is for mocks and local development only; remove it from release builds."
2471
2471
  );
2472
2472
  }
@@ -2480,7 +2480,7 @@ function createAgentRuntime(options) {
2480
2480
  const keepAlive = options.keepAlive ?? "session";
2481
2481
  const staleMs = options.statusStaleMs ?? 5 * 6e4;
2482
2482
  const insecure = options.insecureAddresses ?? {};
2483
- warnInsecure(insecure);
2483
+ warnInsecure(insecure, options.onWarning ?? ((m) => console.warn(m)));
2484
2484
  const live = /* @__PURE__ */ new Map();
2485
2485
  const current = /* @__PURE__ */ new Map();
2486
2486
  const listeners = /* @__PURE__ */ new Set();