cc-viewer 1.9.18 → 1.9.19

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/cli.js CHANGED
@@ -873,6 +873,24 @@ async function runSdkMode(extraClaudeArgs = [], cwd, noOpen = false) {
873
873
  // persistent dialogue row plus a toast; meta (cwd/sessionId/instanceKey, filled by
874
874
  // the sdk-manager session closure) routes it to the owning workspace's viewers.
875
875
  onQueryError: (message, meta) => serverMod.broadcastWsMessage({ type: 'sdk-error', message, ...(meta || {}) }),
876
+ // Authoritative per-turn loop boundaries (immediate, turn-correlated) — the voice
877
+ // pack / plugin lifecycle complement to the debounced turn_end above.
878
+ onAgentLoopStart: (p) => {
879
+ if (typeof serverMod.broadcastAgentLoopStart !== 'function') {
880
+ console.warn('[sdk] serverMod.broadcastAgentLoopStart is not a function (export missing?); loop-start signal dropped');
881
+ return;
882
+ }
883
+ try { serverMod.broadcastAgentLoopStart(p); }
884
+ catch (err) { console.warn('[sdk] broadcastAgentLoopStart threw:', err?.message); }
885
+ },
886
+ onAgentLoopEnd: (p) => {
887
+ if (typeof serverMod.broadcastAgentLoopEnd !== 'function') {
888
+ console.warn('[sdk] serverMod.broadcastAgentLoopEnd is not a function (export missing?); loop-end signal dropped');
889
+ return;
890
+ }
891
+ try { serverMod.broadcastAgentLoopEnd(p); }
892
+ catch (err) { console.warn('[sdk] broadcastAgentLoopEnd threw:', err?.message); }
893
+ },
876
894
  });
877
895
 
878
896
  // Per-cwd multi-session (2026-10-12): hand the boot launch config (proxy env, model,
@@ -918,6 +936,22 @@ async function runSdkMode(extraClaudeArgs = [], cwd, noOpen = false) {
918
936
  catch (err) { console.warn('[sdk] broadcastTurnEnd threw:', err?.message); }
919
937
  },
920
938
  onQueryError: (message, meta) => serverMod.broadcastWsMessage({ type: 'sdk-error', message, ...(meta || {}) }),
939
+ onAgentLoopStart: (p) => {
940
+ if (typeof serverMod.broadcastAgentLoopStart !== 'function') {
941
+ console.warn('[sdk] serverMod.broadcastAgentLoopStart is not a function (export missing?); loop-start signal dropped');
942
+ return;
943
+ }
944
+ try { serverMod.broadcastAgentLoopStart(p); }
945
+ catch (err) { console.warn('[sdk] broadcastAgentLoopStart threw:', err?.message); }
946
+ },
947
+ onAgentLoopEnd: (p) => {
948
+ if (typeof serverMod.broadcastAgentLoopEnd !== 'function') {
949
+ console.warn('[sdk] serverMod.broadcastAgentLoopEnd is not a function (export missing?); loop-end signal dropped');
950
+ return;
951
+ }
952
+ try { serverMod.broadcastAgentLoopEnd(p); }
953
+ catch (err) { console.warn('[sdk] broadcastAgentLoopEnd threw:', err?.message); }
954
+ },
921
955
  broadcastWs: (msg) => serverMod.broadcastWsMessage(msg),
922
956
  runWaterfallHook,
923
957
  });