codicent-app-sdk 0.3.54 → 0.3.55

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.
@@ -1 +1 @@
1
- {"version":3,"file":"useAudioRecorder.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAudioRecorder.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,UAAU,cAAc;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,gBAAgB,mBAAoB,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,KA2J/E,kBACN,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"useAudioRecorder.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAudioRecorder.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,UAAU,cAAc;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,gBAAgB,mBAAoB,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,KA6L/E,kBACN,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");const r=r=>{const[t,n]=e.useState({isRecording:!1,isPaused:!1,recordingTime:0,mediaURL:null,isSoundCaptured:!1,error:null}),c=e.useRef(!1),a=e.useRef(null),u=e.useRef([]),s=e.useRef(),o=e.useRef(null),i=e.useRef(""),d=e.useCallback((async e=>{i.current=e;try{const e=await navigator.mediaDevices.getUserMedia({audio:!0});u.current=[],a.current=new MediaRecorder(e,{mimeType:R()}),a.current.ondataavailable=e=>{e.data.size>0&&u.current.push(e.data)},a.current.onstop=()=>{const r=new Blob(u.current,{type:R()}),t=URL.createObjectURL(r);n((e=>({...e,mediaURL:t}))),e.getTracks().forEach((e=>e.stop()))};const r=new(window.AudioContext||window.webkitAudioContext),t=r.createMediaStreamSource(e),i=r.createAnalyser();i.fftSize=256;const d=new Uint8Array(i.frequencyBinCount);t.connect(i);const l=()=>{i.getByteFrequencyData(d);const e=d.reduce(((e,r)=>e+r))/d.length>10;e!==c.current&&(c.current=e,n((r=>({...r,isSoundCaptured:e}))))};o.current=setInterval(l,100),a.current.start(10),s.current=setInterval((()=>{n((e=>({...e,recordingTime:e.recordingTime+1})))}),1e3),n((e=>({...e,isRecording:!0,isPaused:!1})))}catch(e){const r=e instanceof Error?e.message:String(e);n((e=>({...e,error:r}))),console.error("Error accessing microphone:",e)}}),[]),l=e.useCallback((()=>{a.current&&t.isRecording&&(a.current.stop(),a.current.stream.getTracks().forEach((e=>e.stop())),s.current&&clearInterval(s.current),o.current&&(clearInterval(o.current),o.current=null),n((e=>({...e,isRecording:!1,isPaused:!1,isSoundCaptured:!1}))))}),[t.isRecording]),g=e.useCallback((()=>{"recording"===a.current?.state&&(a.current.pause(),s.current&&clearInterval(s.current),n((e=>({...e,isPaused:!0}))))}),[]),p=e.useCallback((()=>{"paused"===a.current?.state&&(a.current.resume(),s.current=setInterval((()=>{n((e=>({...e,recordingTime:e.recordingTime+1})))}),1e3),n((e=>({...e,isPaused:!1}))))}),[]),R=()=>["audio/webm","audio/mp4","audio/ogg","audio/wav"].find((e=>MediaRecorder.isTypeSupported(e)))||"audio/webm";return e.useEffect((()=>{if(t.mediaURL){const e=`audio.${R().split("/")[1]}`;fetch(t.mediaURL).then((e=>e.blob())).then((t=>{const n=new FormData;n.append("file",t,e),r(n,i.current)}))}}),[t.mediaURL,r]),e.useEffect((()=>()=>{a.current&&a.current.stream.getTracks().forEach((e=>e.stop())),s.current&&clearInterval(s.current),o.current&&clearInterval(o.current)}),[]),{...t,startRecording:d,stopRecording:l,pauseRecording:g,resumeRecording:p}};exports.default=r,exports.useAudioRecorder=r;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");const r=r=>{const[t,n]=e.useState({isRecording:!1,isPaused:!1,recordingTime:0,mediaURL:null,isSoundCaptured:!1,error:null}),c=e.useRef(!1),u=e.useRef(null),a=e.useRef(null),s=e.useRef(null),o=e.useRef([]),i=e.useRef(),d=e.useRef(null),l=e.useRef(""),p=e.useCallback((async e=>{l.current=e;try{const e=await navigator.mediaDevices.getUserMedia({audio:!0});o.current=[],s.current=new MediaRecorder(e,{mimeType:f()}),s.current.ondataavailable=e=>{e.data.size>0&&o.current.push(e.data)},s.current.onstop=()=>{const r=new Blob(o.current,{type:f()}),t=URL.createObjectURL(r);n((e=>({...e,mediaURL:t}))),e.getTracks().forEach((e=>e.stop()))};const r=new(window.AudioContext||window.webkitAudioContext);a.current=r;const t=r.createMediaStreamSource(e),l=r.createAnalyser();l.fftSize=256;const p=new Uint8Array(l.frequencyBinCount);t.connect(l);const A=()=>{l.getByteFrequencyData(p);const e=p.reduce(((e,r)=>e+r))/p.length>10;e!==c.current&&(c.current=e,n((r=>({...r,isSoundCaptured:e}))))};d.current=setInterval(A,100),u.current||(u.current=new Audio("data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQAAAAA="),u.current.loop=!0,u.current.volume=0),u.current.play().catch((()=>{})),s.current.start(10),i.current=setInterval((()=>{n((e=>({...e,recordingTime:e.recordingTime+1})))}),1e3),n((e=>({...e,isRecording:!0,isPaused:!1})))}catch(e){const r=e instanceof Error?e.message:String(e);n((e=>({...e,error:r}))),console.error("Error accessing microphone:",e)}}),[]),A=e.useCallback((()=>{s.current&&t.isRecording&&(s.current.stop(),s.current.stream.getTracks().forEach((e=>e.stop())),i.current&&clearInterval(i.current),d.current&&(clearInterval(d.current),d.current=null),u.current&&(u.current.pause(),u.current.currentTime=0),n((e=>({...e,isRecording:!1,isPaused:!1,isSoundCaptured:!1}))))}),[t.isRecording]);e.useEffect((()=>{let e=null;return t.isRecording&&a.current&&(e=setInterval((()=>{a.current&&"suspended"===a.current.state&&a.current.resume()}),1e3)),()=>{e&&clearInterval(e)}}),[t.isRecording]);const g=e.useCallback((()=>{"recording"===s.current?.state&&(s.current.pause(),i.current&&clearInterval(i.current),n((e=>({...e,isPaused:!0}))))}),[]),R=e.useCallback((()=>{"paused"===s.current?.state&&(s.current.resume(),i.current=setInterval((()=>{n((e=>({...e,recordingTime:e.recordingTime+1})))}),1e3),n((e=>({...e,isPaused:!1}))))}),[]),f=()=>["audio/webm","audio/mp4","audio/ogg","audio/wav"].find((e=>MediaRecorder.isTypeSupported(e)))||"audio/webm";return e.useEffect((()=>{if(t.mediaURL){const e=`audio.${f().split("/")[1]}`;fetch(t.mediaURL).then((e=>e.blob())).then((t=>{const n=new FormData;n.append("file",t,e),r(n,l.current)}))}}),[t.mediaURL,r]),e.useEffect((()=>()=>{s.current&&s.current.stream.getTracks().forEach((e=>e.stop())),i.current&&clearInterval(i.current),d.current&&clearInterval(d.current)}),[]),{...t,startRecording:p,stopRecording:A,pauseRecording:g,resumeRecording:R}};exports.default=r,exports.useAudioRecorder=r;
@@ -1 +1 @@
1
- {"version":3,"file":"useAudioRecorder.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAudioRecorder.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;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B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,UAAU,cAAc;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,gBAAgB,mBAAoB,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,KA6L/E,kBACN,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- import{useState as e,useRef as r,useCallback as t,useEffect as n}from"react";const c=c=>{const[a,o]=e({isRecording:!1,isPaused:!1,recordingTime:0,mediaURL:null,isSoundCaptured:!1,error:null}),i=r(!1),u=r(null),s=r([]),d=r(),l=r(null),g=r(""),m=t((async e=>{g.current=e;try{const e=await navigator.mediaDevices.getUserMedia({audio:!0});s.current=[],u.current=new MediaRecorder(e,{mimeType:f()}),u.current.ondataavailable=e=>{e.data.size>0&&s.current.push(e.data)},u.current.onstop=()=>{const r=new Blob(s.current,{type:f()}),t=URL.createObjectURL(r);o((e=>({...e,mediaURL:t}))),e.getTracks().forEach((e=>e.stop()))};const r=new(window.AudioContext||window.webkitAudioContext),t=r.createMediaStreamSource(e),n=r.createAnalyser();n.fftSize=256;const c=new Uint8Array(n.frequencyBinCount);t.connect(n);const a=()=>{n.getByteFrequencyData(c);const e=c.reduce(((e,r)=>e+r))/c.length>10;e!==i.current&&(i.current=e,o((r=>({...r,isSoundCaptured:e}))))};l.current=setInterval(a,100),u.current.start(10),d.current=setInterval((()=>{o((e=>({...e,recordingTime:e.recordingTime+1})))}),1e3),o((e=>({...e,isRecording:!0,isPaused:!1})))}catch(e){const r=e instanceof Error?e.message:String(e);o((e=>({...e,error:r}))),console.error("Error accessing microphone:",e)}}),[]),p=t((()=>{u.current&&a.isRecording&&(u.current.stop(),u.current.stream.getTracks().forEach((e=>e.stop())),d.current&&clearInterval(d.current),l.current&&(clearInterval(l.current),l.current=null),o((e=>({...e,isRecording:!1,isPaused:!1,isSoundCaptured:!1}))))}),[a.isRecording]),R=t((()=>{"recording"===u.current?.state&&(u.current.pause(),d.current&&clearInterval(d.current),o((e=>({...e,isPaused:!0}))))}),[]),w=t((()=>{"paused"===u.current?.state&&(u.current.resume(),d.current=setInterval((()=>{o((e=>({...e,recordingTime:e.recordingTime+1})))}),1e3),o((e=>({...e,isPaused:!1}))))}),[]),f=()=>["audio/webm","audio/mp4","audio/ogg","audio/wav"].find((e=>MediaRecorder.isTypeSupported(e)))||"audio/webm";return n((()=>{if(a.mediaURL){const e=`audio.${f().split("/")[1]}`;fetch(a.mediaURL).then((e=>e.blob())).then((r=>{const t=new FormData;t.append("file",r,e),c(t,g.current)}))}}),[a.mediaURL,c]),n((()=>()=>{u.current&&u.current.stream.getTracks().forEach((e=>e.stop())),d.current&&clearInterval(d.current),l.current&&clearInterval(l.current)}),[]),{...a,startRecording:m,stopRecording:p,pauseRecording:R,resumeRecording:w}};export{c as default,c as useAudioRecorder};
1
+ import{useState as e,useRef as r,useCallback as t,useEffect as n}from"react";const c=c=>{const[a,u]=e({isRecording:!1,isPaused:!1,recordingTime:0,mediaURL:null,isSoundCaptured:!1,error:null}),o=r(!1),i=r(null),s=r(null),d=r(null),l=r([]),g=r(),m=r(null),A=r(""),p=t((async e=>{A.current=e;try{const e=await navigator.mediaDevices.getUserMedia({audio:!0});l.current=[],d.current=new MediaRecorder(e,{mimeType:f()}),d.current.ondataavailable=e=>{e.data.size>0&&l.current.push(e.data)},d.current.onstop=()=>{const r=new Blob(l.current,{type:f()}),t=URL.createObjectURL(r);u((e=>({...e,mediaURL:t}))),e.getTracks().forEach((e=>e.stop()))};const r=new(window.AudioContext||window.webkitAudioContext);s.current=r;const t=r.createMediaStreamSource(e),n=r.createAnalyser();n.fftSize=256;const c=new Uint8Array(n.frequencyBinCount);t.connect(n);const a=()=>{n.getByteFrequencyData(c);const e=c.reduce(((e,r)=>e+r))/c.length>10;e!==o.current&&(o.current=e,u((r=>({...r,isSoundCaptured:e}))))};m.current=setInterval(a,100),i.current||(i.current=new Audio("data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQAAAAA="),i.current.loop=!0,i.current.volume=0),i.current.play().catch((()=>{})),d.current.start(10),g.current=setInterval((()=>{u((e=>({...e,recordingTime:e.recordingTime+1})))}),1e3),u((e=>({...e,isRecording:!0,isPaused:!1})))}catch(e){const r=e instanceof Error?e.message:String(e);u((e=>({...e,error:r}))),console.error("Error accessing microphone:",e)}}),[]),R=t((()=>{d.current&&a.isRecording&&(d.current.stop(),d.current.stream.getTracks().forEach((e=>e.stop())),g.current&&clearInterval(g.current),m.current&&(clearInterval(m.current),m.current=null),i.current&&(i.current.pause(),i.current.currentTime=0),u((e=>({...e,isRecording:!1,isPaused:!1,isSoundCaptured:!1}))))}),[a.isRecording]);n((()=>{let e=null;return a.isRecording&&s.current&&(e=setInterval((()=>{s.current&&"suspended"===s.current.state&&s.current.resume()}),1e3)),()=>{e&&clearInterval(e)}}),[a.isRecording]);const v=t((()=>{"recording"===d.current?.state&&(d.current.pause(),g.current&&clearInterval(g.current),u((e=>({...e,isPaused:!0}))))}),[]),w=t((()=>{"paused"===d.current?.state&&(d.current.resume(),g.current=setInterval((()=>{u((e=>({...e,recordingTime:e.recordingTime+1})))}),1e3),u((e=>({...e,isPaused:!1}))))}),[]),f=()=>["audio/webm","audio/mp4","audio/ogg","audio/wav"].find((e=>MediaRecorder.isTypeSupported(e)))||"audio/webm";return n((()=>{if(a.mediaURL){const e=`audio.${f().split("/")[1]}`;fetch(a.mediaURL).then((e=>e.blob())).then((r=>{const t=new FormData;t.append("file",r,e),c(t,A.current)}))}}),[a.mediaURL,c]),n((()=>()=>{d.current&&d.current.stream.getTracks().forEach((e=>e.stop())),g.current&&clearInterval(g.current),m.current&&clearInterval(m.current)}),[]),{...a,startRecording:p,stopRecording:R,pauseRecording:v,resumeRecording:w}};export{c as default,c as useAudioRecorder};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codicent-app-sdk",
3
- "version": "0.3.54",
3
+ "version": "0.3.55",
4
4
  "description": "SDK for building AI-powered applications with Codicent",
5
5
  "type": "module",
6
6
  "main": "dist/cjs/index.js",