@minicode-dev/chat 0.1.11 → 0.1.13

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.
Files changed (33) hide show
  1. package/README.md +102 -6
  2. package/assets/sounds/effects/avalanche.mp3 +0 -0
  3. package/dist/chunks/{TanksGameCard-B47ZQcSr.js → TanksGameCard-GrqmdwJ7.js} +2 -2
  4. package/dist/chunks/{TanksGameCard-B47ZQcSr.js.map → TanksGameCard-GrqmdwJ7.js.map} +1 -1
  5. package/dist/chunks/TanksLiveGameCard-DSmQcUMh.js +1225 -0
  6. package/dist/chunks/TanksLiveGameCard-DSmQcUMh.js.map +1 -0
  7. package/dist/chunks/{WebRtcLab-lijo_Rta.js → WebRtcLab-ClRSYt4E.js} +2 -2
  8. package/dist/chunks/{WebRtcLab-lijo_Rta.js.map → WebRtcLab-ClRSYt4E.js.map} +1 -1
  9. package/dist/chunks/avalancheScene3d-Dnl2E3EA.js +1878 -0
  10. package/dist/chunks/avalancheScene3d-Dnl2E3EA.js.map +1 -0
  11. package/dist/chunks/createLiveScene-819NWv84.js +365 -0
  12. package/dist/chunks/createLiveScene-819NWv84.js.map +1 -0
  13. package/dist/chunks/createPeerLink-DBVs_yvQ.js +1136 -0
  14. package/dist/chunks/createPeerLink-DBVs_yvQ.js.map +1 -0
  15. package/dist/chunks/{createTankScene-CV7Brxmt.js → createTankScene-6asWHKFf.js} +120 -119
  16. package/dist/chunks/{createTankScene-CV7Brxmt.js.map → createTankScene-6asWHKFf.js.map} +1 -1
  17. package/dist/chunks/fx-BNJvJYOu.js +871 -0
  18. package/dist/chunks/fx-BNJvJYOu.js.map +1 -0
  19. package/dist/chunks/tank-DIn6Jyt8.js +605 -0
  20. package/dist/chunks/tank-DIn6Jyt8.js.map +1 -0
  21. package/dist/index.js +1581 -1184
  22. package/dist/index.js.map +1 -1
  23. package/dist/styles.css +1 -1
  24. package/index.d.ts +23 -3
  25. package/package.json +1 -1
  26. package/dist/chunks/TanksLiveGameCard-BNJqWt1z.js +0 -915
  27. package/dist/chunks/TanksLiveGameCard-BNJqWt1z.js.map +0 -1
  28. package/dist/chunks/createLiveScene-CJQtq54t.js +0 -364
  29. package/dist/chunks/createLiveScene-CJQtq54t.js.map +0 -1
  30. package/dist/chunks/createPeerLink-CL7VZuHS.js +0 -480
  31. package/dist/chunks/createPeerLink-CL7VZuHS.js.map +0 -1
  32. package/dist/chunks/fx-BHsl4S_J.js +0 -1470
  33. package/dist/chunks/fx-BHsl4S_J.js.map +0 -1
package/README.md CHANGED
@@ -180,10 +180,10 @@ a script with that name that calls `npm publish` could invoke itself recursively
180
180
 
181
181
  ## Feature implementation notes
182
182
 
183
- For AI handoff and troubleshooting context, see [CONTEXTO_PARA_IA.md](CONTEXTO_PARA_IA.md)
183
+ For AI handoff and troubleshooting context, see [docs/contexto-para-ia.md](docs/contexto-para-ia.md)
184
184
  in the source repository (not included in the npm archive).
185
185
 
186
- For the Spanish implementation record and demo walkthrough, see [NUEVAS_FUNCIONES.md](NUEVAS_FUNCIONES.md)
186
+ For the Spanish implementation record and demo walkthrough, see [docs/funciones/README.md](docs/funciones/README.md)
187
187
  in the source repository. This companion document is not included in the npm archive;
188
188
  the integration sections below are included.
189
189
 
@@ -214,7 +214,7 @@ and 2048 × 2048) and an example image. Open **Nuevas funciones** to try it.
214
214
  ## Countdown messages
215
215
 
216
216
  Open **✨ → Cuenta regresiva**, choose a quick duration button or a custom duration in seconds or minutes
217
- (up to 24 hours), select the final effect (pig, confetti or nudge), and choose
217
+ (up to 24 hours), select the final effect (pig, confetti, avalanche or nudge), and choose
218
218
  whether to include its sound. **Probar efecto** previews the selection without sending.
219
219
  Send it to display a live countdown in the conversation. The card hides the chosen
220
220
  effect until zero; quotes and conversation previews also keep the surprise.
@@ -229,9 +229,12 @@ the deadline effect; expired cards offer manual replay on return.
229
229
 
230
230
  ## Zumbidos and animated effects
231
231
 
232
- The chat includes a nudge, a dancing pig and confetti with approved audio recordings.
232
+ The chat includes a nudge (Zumbido), a dancing pig (Cerdito disco), confetti (Confeti) and
233
+ an avalanche (Avalancha 🚀: a 3D shower of money, cars, tanks and confetti).
233
234
  The pig uses `cerdito_disco_original.mp3`; nudge and confetti use `nudge.mp3` and `confetti.mp3`
234
- in the same `assets/sounds/effects/` directory. Serve
235
+ in the same `assets/sounds/effects/` directory. The avalanche uses `avalanche.mp3` from the same folder.
236
+ Confetti and avalanche render with the optional `three` peer (loaded lazily) and fall back to CSS
237
+ without `three`/WebGL or with reduced motion. Serve
235
238
  `assets/sounds/effects/cerdito_disco_original.mp3` at `/sounds/effects/cerdito_disco_original.mp3`,
236
239
  or use the existing `setChatAssetsBaseUrl` sound asset configuration. Copying the complete
237
240
  `assets/sounds/` directory as described above includes this recording.
@@ -300,7 +303,7 @@ proposal; the nudge and confetti WAVs are the original sources of the approved r
300
303
  `predev` generates the WAV files automatically. Use `npm run audio:samples` to regenerate
301
304
  them separately. Generated files live in `demo/audio-samples/`, are ignored by Git and
302
305
  excluded from npm. Source generators are in `demo/audio-lab/`; see
303
- [AUDIO_EFFECTS.md](AUDIO_EFFECTS.md) in the source repository for the arrangement and limitations.
306
+ [docs/funciones/efectos.md](docs/funciones/efectos.md#audio) in the source repository for the arrangement and limitations.
304
307
 
305
308
  ### Fun chat defaults
306
309
 
@@ -337,3 +340,96 @@ Use WASD/arrows, mouse and click/space on desktop, or the joystick, arena touch
337
340
  button on mobile. Minimize preserves the match; reload/reopening the chat is not a persisted
338
341
  match recovery flow. Wi-Fi versus cellular connectivity and runtime TURN still require real-device
339
342
  validation.
343
+
344
+ ### Manual TURN recovery inside TANQUES LIVE
345
+
346
+ Both players need a version with manual TURN support. No Django endpoint, consumer,
347
+ WebSocket protocol change, Cloudflare SDK, or application-level screen is required.
348
+ The existing `webrtc.iceServers` and `iceTransportPolicy` provider settings continue
349
+ working. Manual settings belong only to the current match and are not persisted.
350
+
351
+ 1. Invite the other player and accept the match normally. Local/direct connections
352
+ keep working without TURN.
353
+ 2. During negotiation (or even during a connected match), choose **Configurar
354
+ conexión alternativa**. A slow or failed negotiation also shows a connection notice.
355
+ 3. **One player** pastes the JSON containing temporary `iceServers` and selects
356
+ **Aplicar y reconectar**. The other player receives and applies it automatically;
357
+ they do not need to paste anything.
358
+ 4. Wait for the sharing confirmation, then inspect the actual connection state.
359
+ Applied credentials do not by themselves prove that TURN is reachable or in use.
360
+
361
+ The modal accepts `{ "iceServers": [...] }` and a full Cloudflare envelope such as
362
+ `{ "success": true, "result": { "iceServers": [...] } }`. It rejects invalid JSON,
363
+ STUN-only configurations, invalid ICE URLs, missing TURN passwords, known expired
364
+ credentials, and API-token fields. Limits: 6,000 characters/UTF-8 bytes, eight ICE
365
+ servers and sixteen URLs. Only `stun:`, `stuns:`, `turn:` and `turns:` URLs are allowed.
366
+
367
+ **Never paste the permanent Cloudflare TURN API token.** Generate temporary
368
+ credentials externally in your terminal. For example, with your credentials already
369
+ set in your terminal environment (not in React), this copies only the temporary
370
+ response to the macOS clipboard:
371
+
372
+ ```sh
373
+ curl --fail --silent --show-error \
374
+ "https://rtc.live.cloudflare.com/v1/turn/keys/${CLOUDFLARE_TURN_KEY_ID}/credentials/generate-ice-servers" \
375
+ --header "Authorization: Bearer ${CLOUDFLARE_TURN_KEY_API_TOKEN}" \
376
+ --header "Content-Type: application/json" \
377
+ --data '{"ttl":3600}' | pbcopy
378
+ ```
379
+
380
+ The library never calls that API. The optional **Validez restante en segundos** field
381
+ means remaining validity from now, not the original issuance TTL. Leave it blank
382
+ when unknown; Cloudflare's opaque username is not treated as an expiry timestamp.
383
+ You can also supply `expiresAt` (ISO text or Unix milliseconds) or `expiresIn`/`ttl`
384
+ (remaining seconds) in the JSON. Known-expired settings are refused; expiry unknown
385
+ cannot be detected reliably from every ICE authentication failure, so obtain and
386
+ paste new credentials if the old ones stop working.
387
+
388
+ Recovery uses the private chat signaling already used for SDP/ICE. A tab-bound,
389
+ ephemeral ECDH/AES-GCM exchange encrypts the credentials before they enter the chat
390
+ transport. The host coordinates preparation, confirmation and recovery so either
391
+ player can initiate without racing two restart offers. A healthy direct connection
392
+ with policy `all` is kept; new fallback settings do not trigger an unnecessary
393
+ restart. Otherwise the link updates `setConfiguration()` and restarts ICE, or
394
+ recreates only PeerConnections when necessary. Positions, health and match state
395
+ remain in the existing simulation. Drafts clear on closing/applying the dialog;
396
+ credentials and encryption keys clear when the match ends or is destroyed.
397
+
398
+ The library excludes these internal frames from its visible client history and
399
+ unread counts; any server that stores all chat frames may still retain encrypted
400
+ signaling. No plaintext TURN password is sent in those frames. This relies on the
401
+ existing authenticated private-room relay; it is not protection against an actively
402
+ malicious signaling server. HTTPS (or localhost) and Web Crypto are required. Without
403
+ Web Crypto, sharing fails safely instead of sending plaintext. Closing the dialog
404
+ does not end the match; an already-started synchronization can still finish.
405
+
406
+ **Diagnostics and real-network validation:**
407
+
408
+ - Open **Diagnóstico de conexión** to see SDP/ICE/gathering states, DataChannel
409
+ readiness, reconnects, connection time, RTT and sanitized ICE errors/counters.
410
+ - `turnConfigured` only means a TURN URL is configured. `candidates.localRelay`
411
+ means relay candidates were gathered. `selectedPair.relay: true` means the actual
412
+ selected candidate pair uses TURN. No passwords, usernames, SDP or private candidate
413
+ addresses are included in the panel.
414
+ - To verify TURN, temporarily enable **Forzar relay para diagnóstico**. It is shared
415
+ with the settings so both peers use `iceTransportPolicy: "relay"`. Confirm both
416
+ DataChannels are open, `phase` is `connected`, the selected pair is relay, and
417
+ movement counters increase on both devices. Disable the option for normal play.
418
+ - Test from two devices on different networks (for example Wi-Fi and cellular),
419
+ with current temporary credentials. Also test interruption/retry and renewing
420
+ credentials from either player. No implementation can guarantee connectivity
421
+ through every restrictive firewall; TURN/TLS over TCP may add latency/jitter.
422
+ - The local two-player demo remains `/tanks-live-lab.html?user=ana` and
423
+ `/tanks-live-lab.html?user=luis`. Automated tests use fake RTC/TURN to verify
424
+ synchronization, retries, privacy and state preservation; they do not prove that
425
+ a real TURN service is reachable across networks.
426
+
427
+ For repeatable browser QA, `scripts/check-manual-turn-browser.mjs` uses Playwright
428
+ as an optional development tool (not a library dependency). Run the demo, make a
429
+ Playwright installation available, then run the script. `CHAT_DEMO_URL` overrides
430
+ the default `http://127.0.0.1:5173`; `PLAYWRIGHT_MODULE` and
431
+ `PLAYWRIGHT_EXECUTABLE_PATH` can select an existing tooling installation. It checks
432
+ two real local browser peers, host/guest manual sharing with dummy credentials,
433
+ invalid inputs, light/dark/mobile dialogs, cancellation and simulated blocked ICE.
434
+ Its headless-only flags allow local candidates without mDNS resolution. The script
435
+ never tests real TURN credentials or proves Wi-Fi/cellular connectivity.
@@ -938,7 +938,7 @@ function Be(e, t, n, r) {
938
938
  o("none");
939
939
  }
940
940
  };
941
- return o("loading"), u || !h() ? f() : import("./createTankScene-CV7Brxmt.js").then(({ createTankScene: e }) => {
941
+ return o("loading"), u || !h() ? f() : import("./createTankScene-6asWHKFf.js").then(({ createTankScene: e }) => {
942
942
  if (!r) try {
943
943
  d(e(n, s), "3d");
944
944
  } catch {
@@ -1532,4 +1532,4 @@ function $({ gameKey: e, currentUserId: n, variant: r = "panel", onMinimize: i,
1532
1532
  var Ue = x($);
1533
1533
  export { Ue as default };
1534
1534
 
1535
- //# sourceMappingURL=TanksGameCard-B47ZQcSr.js.map
1535
+ //# sourceMappingURL=TanksGameCard-GrqmdwJ7.js.map