opencharm 0.6.0 → 0.6.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/dist/main.mjs CHANGED
@@ -969,7 +969,7 @@ function sendAdmin(socketPath, request) {
969
969
  }
970
970
  //#endregion
971
971
  //#region package.json
972
- var version = "0.6.0";
972
+ var version = "0.6.1";
973
973
  function channelToCube(value) {
974
974
  if (value < 48) return 0;
975
975
  if (value < 115) return 1;
@@ -3300,6 +3300,7 @@ function cleanForSpeech(text) {
3300
3300
  //#endregion
3301
3301
  //#region ../charmd/src/turn/turn.ts
3302
3302
  const MAX_FRAMES = 1e3;
3303
+ const LEAD_MS = 250;
3303
3304
  const READING_WORDS_PER_SECOND = 3;
3304
3305
  const MIN_READING_MS = 2e3;
3305
3306
  const LOOKAHEAD = 2;
@@ -3332,6 +3333,7 @@ var TurnController = class {
3332
3333
  #generation = 0;
3333
3334
  #controller;
3334
3335
  #speaking = false;
3336
+ #playedBy = 0;
3335
3337
  #asking;
3336
3338
  #endFace;
3337
3339
  #deps;
@@ -3601,6 +3603,7 @@ var TurnController = class {
3601
3603
  if (!this.#speaking) {
3602
3604
  this.#speaking = true;
3603
3605
  this.#state = "speaking";
3606
+ this.#playedBy = 0;
3604
3607
  timings.firstAudioMs = now() - started;
3605
3608
  clock.started();
3606
3609
  this.#deps.send({
@@ -3709,12 +3712,14 @@ var TurnController = class {
3709
3712
  }
3710
3713
  async #sendPaced(packets, live, onPacket) {
3711
3714
  const sleep = this.#deps.sleep ?? sleepMs;
3712
- let index = 0;
3715
+ const now = this.#deps.now ?? Date.now;
3713
3716
  for await (const packet of packets) {
3714
3717
  if (!live()) return;
3715
3718
  this.#deps.sendAudio(packet);
3716
3719
  onPacket();
3717
- if (index++ >= 2) await sleep(opusPacketSamples48k(packet) / 48);
3720
+ this.#playedBy = Math.max(this.#playedBy, now()) + opusPacketSamples48k(packet) / 48;
3721
+ const wait = this.#playedBy - LEAD_MS - now();
3722
+ if (wait > 0) await sleep(wait);
3718
3723
  }
3719
3724
  }
3720
3725
  dispose() {
@@ -4936,7 +4941,7 @@ function formatIdentity(unit, version, commit) {
4936
4941
  let cached;
4937
4942
  function identity() {
4938
4943
  if (cached) return cached;
4939
- const commit = "cb4cbce";
4944
+ const commit = "e5ffe6e";
4940
4945
  cached = {
4941
4946
  version: `cli@${version}`,
4942
4947
  commit,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencharm",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "An open-source body for the AI agent you already run: a face, a voice, one key. Claude Code, Codex, Gemini CLI, Hermes, OpenClaw or any ACP or OpenAI-compatible agent; on a small board, your Mac's notch or the browser.",
5
5
  "type": "module",
6
6
  "bin": {
Binary file