@redocly/replay 0.28.0-next.7 → 0.28.0-next.9

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 (69) hide show
  1. package/dist/{replay-AiChatProvider-Dib77evR.js → replay-AiChatProvider-B_f9Wn8a.js} +1 -1
  2. package/dist/{replay-AiChatProvider-CL61KEj-.js → replay-AiChatProvider-DuTK5g1N.js} +41 -41
  3. package/dist/{replay-AiChatSqliteDBStorage-CAB-uQ_2.js → replay-AiChatSqliteDBStorage-CHfMo6M6.js} +1 -1
  4. package/dist/{replay-AiChatSqliteDBStorage-BmHRaty6.js → replay-AiChatSqliteDBStorage-cXsRIQfJ.js} +6 -6
  5. package/dist/{replay-AiPanel-CKf0GTch.js → replay-AiPanel-CGbGwIMX.js} +35 -35
  6. package/dist/{replay-AiPanel-Co-SG9hy.js → replay-AiPanel-C_C52r20.js} +1 -1
  7. package/dist/replay-FileWatcher-DEOB0_DG.js +1 -0
  8. package/dist/{replay-FileWatcher-BpncVTHg.js → replay-FileWatcher-Z6eygcBI.js} +4 -5
  9. package/dist/{replay-HistorySqliteDBStorage-CtF6-vY8.js → replay-HistorySqliteDBStorage-Bi5vBQ2T.js} +2 -2
  10. package/dist/{replay-SemanticSearchService-B_97hbQZ.js → replay-SemanticSearchService-BLF1oOOu.js} +8 -12
  11. package/dist/replay-SemanticSearchService-DTc0oxN4.js +1 -0
  12. package/dist/{replay-SqliteDBStorage-BYAD4Hdr.js → replay-SqliteDBStorage-B_kyJ0a3.js} +1 -1
  13. package/dist/{replay-SqliteDBStorage-C4jv_awl.js → replay-SqliteDBStorage-DF9kKplR.js} +49 -49
  14. package/dist/{replay-StepContextSqliteDBStorage-BfAAKDwA.js → replay-StepContextSqliteDBStorage-BkB2NM27.js} +2 -2
  15. package/dist/{replay-TauriFileSystemAdapter-DNp7rTwA.js → replay-TauriFileSystemAdapter-CwSMakdJ.js} +1 -1
  16. package/dist/{replay-TauriFileSystemAdapter-dRydQRfd.js → replay-TauriFileSystemAdapter-DcFBYSUW.js} +8 -8
  17. package/dist/{replay-TauriRootStorage-TvtzeQ9x.js → replay-TauriRootStorage-DEGEIJrz.js} +1 -1
  18. package/dist/{replay-TauriRootStorage-BUSjQzb0.js → replay-TauriRootStorage-Den8gI4S.js} +85 -85
  19. package/dist/{replay-agent-loop-Bv3OEM5Y.js → replay-agent-loop-B8Mjb8DU.js} +9 -9
  20. package/dist/{replay-agent-loop-FONgy9Lo.js → replay-agent-loop-Z_nrrmg_.js} +1 -1
  21. package/dist/{replay-ai-chat-mappers-Kj9YEXwF.js → replay-ai-chat-mappers-D7e8buTk.js} +3 -3
  22. package/dist/{replay-ai-chat-mappers-CknwkJ22.js → replay-ai-chat-mappers-aJ_VMb6Z.js} +1 -1
  23. package/dist/{replay-ai-message-parts.schema-E9u9-nqr.js → replay-ai-message-parts.schema-DKLf0SiG.js} +1 -1
  24. package/dist/{replay-create-model-DgfhU1ps.js → replay-create-model-Be3vPVDb.js} +3 -3
  25. package/dist/{replay-create-model-Bq8Fl5Ai.js → replay-create-model-Bw20x80b.js} +3 -3
  26. package/dist/{replay-db-DjHsvWMQ.js → replay-db-BQXljNM0.js} +1 -1
  27. package/dist/{replay-db-D3MZ3YVw.js → replay-db-BmZNrdZM.js} +5 -5
  28. package/dist/{replay-external-resolver-DgcgzfRI.js → replay-external-resolver-BLzbbtnT.js} +1 -1
  29. package/dist/{replay-external-resolver-SsE1pZoq.js → replay-external-resolver-BQvSDNfH.js} +7 -7
  30. package/dist/{replay-history.schema-5ce6X0R1.js → replay-history.schema-B0lLwmdG.js} +3 -3
  31. package/dist/{replay-index-l3GM4sbc.js → replay-index-B-uZhXHj.js} +1 -1
  32. package/dist/{replay-index-B-Z3hRlH.js → replay-index-BCz452N6.js} +16025 -15956
  33. package/dist/{replay-index-DzrZDRUX.js → replay-index-C0kvTxxm.js} +38 -38
  34. package/dist/{replay-index-eABpOyfi.js → replay-index-C7y4K4Cr.js} +1 -1
  35. package/dist/replay-index-DAIwC3ls.js +1 -0
  36. package/dist/{replay-index-AEsPADo_.js → replay-index-DYtXcqDk.js} +1014 -1010
  37. package/dist/replay-index-gM6vL6iT.js +4 -0
  38. package/dist/{replay-index-BJ5jmb2F.js → replay-index-wBHsAQEV.js} +1 -1
  39. package/dist/{replay-indexes-CfsvVMi_.js → replay-indexes-B3PJtgeh.js} +43 -43
  40. package/dist/replay-lint-BzkTeXqI.js +177 -0
  41. package/dist/{replay-lint-BHwuW5sm.js → replay-lint-CqDMOMQt.js} +11038 -10749
  42. package/dist/{replay-lint-graphql-taKxgtqM.js → replay-lint-graphql-BDBGJSir.js} +1 -1
  43. package/dist/{replay-lint-graphql-CcbpryHy.js → replay-lint-graphql-BZF2eLiZ.js} +1 -1
  44. package/dist/replay-periodic-revalidation-C7SkB1vs.js +1 -0
  45. package/dist/{replay-periodic-revalidation-CEMQo8s1.js → replay-periodic-revalidation-orCv_JoF.js} +4 -5
  46. package/dist/{replay-resolve-DJdvx14A.js → replay-resolve-0e5f8I7b.js} +18 -18
  47. package/dist/{replay-resolve-CSzH6SDp.js → replay-resolve-DZMWoig2.js} +176 -176
  48. package/dist/replay-respect-run-CLW3wGhx.js +8392 -0
  49. package/dist/replay-respect-run-ChP63WzG.js +82 -0
  50. package/dist/replay-step-context.schema-BOprzd6Z.js +21 -0
  51. package/dist/{replay-tauri-path-D_hXMLdc.js → replay-tauri-path-DBt1dqkG.js} +1 -1
  52. package/dist/replay-tauri-path-DvLF4Z8f.js +22 -0
  53. package/dist/{replay-useAiChatQueries-DVCG23XB.js → replay-useAiChatQueries-Bypgnkwa.js} +2 -2
  54. package/dist/{replay-useAiChatQueries-DFd8ZJQG.js → replay-useAiChatQueries-S6v5duiJ.js} +131 -137
  55. package/dist/{replay-validate-key-fIEjvAUc.js → replay-validate-key-CMJODIH6.js} +2 -2
  56. package/dist/{replay-validate-key-qqV8ZWzl.js → replay-validate-key-CNl7BV_v.js} +1 -1
  57. package/dist/replay.cjs +1 -1
  58. package/dist/replay.js +10 -10
  59. package/package.json +4 -4
  60. package/dist/replay-FileWatcher-BpsHu7xD.js +0 -1
  61. package/dist/replay-SemanticSearchService-B9YYS_s4.js +0 -1
  62. package/dist/replay-index-B3h5Szid.js +0 -25
  63. package/dist/replay-index-C04sCExL.js +0 -1
  64. package/dist/replay-lint-7nMI-JAv.js +0 -177
  65. package/dist/replay-periodic-revalidation-Cg2y1tgz.js +0 -1
  66. package/dist/replay-respect-run-DTUpcIOb.js +0 -78
  67. package/dist/replay-respect-run-gVY8_9EV.js +0 -8200
  68. package/dist/replay-step-context.schema-DBk4jufr.js +0 -21
  69. package/dist/replay-tauri-path-C-oZvov6.js +0 -22
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("react/jsx-runtime"),i=require("react"),o=require("./replay-index-AEsPADo_.js"),te=require("./replay-create-model-Bq8Fl5Ai.js"),fe=require("./replay-agent-loop-FONgy9Lo.js"),pe=require("./replay-db-DjHsvWMQ.js"),v=require("./replay-useAiChatQueries-DVCG23XB.js"),B=require("@tanstack/react-query"),Z=require("./replay-ai-chat-mappers-CknwkJ22.js");class ge{handlers=new Map;middlewares;constructor(t){this.middlewares=t?.middlewares??[]}register(t){this.handlers.set(t.name,t)}getToolSet(){const t={};for(const[n,s]of this.handlers)t[n]=this.buildTool(s);return t}buildTool(t){return{...t.definition,execute:this.wrapExecutor(t)}}wrapExecutor(t){const n=(a,r)=>({isError:!0,error:{message:a,details:r}}),s=this.applyMiddlewares(t.name,t.execute);return(a,r)=>{if(r.abortSignal?.aborted)return n("Tool execution was aborted.");try{const l=s(a,r);return typeof l=="object"&&l!==null&&"then"in l?l.then(c=>c,c=>n(c instanceof Error?c.message:"Unknown tool execution error")):l}catch(l){return n(l instanceof Error?l.message:"Unknown tool execution error")}}}applyMiddlewares(t,n){return this.middlewares.length===0?n:this.middlewares.reduceRight((s,a)=>a(t,s),n)}}function ce(){const e=B.useQueryClient();return B.useMutation({async mutationFn(t){const n=Z.buildPersistableUiChat(t);await o.AiChatServiceFactory.getInstance().upsert(n)},onSuccess(){e.invalidateQueries({queryKey:o.aiChatKeys.all()})},onError(t){console.error("Failed to upsert ai chat item:",t)}})}function Ce(e){const t=B.useQueryClient(),n=o.aiChatKeys.detailTitle(e??"");return B.useMutation({mutationKey:n,async mutationFn(s){if(t.isMutating({mutationKey:n,exact:!0})>1)return;const a=Z.buildPersistableUiChat(s);await o.AiChatServiceFactory.getInstance().upsert(a)},onSuccess(){t.invalidateQueries({queryKey:o.aiChatKeys.all()})},onError(s){console.error("Failed to upsert ai chat item:",s)}})}function me(){const e=B.useQueryClient();return B.useMutation({async mutationFn(t){await o.AiChatServiceFactory.getInstance().remove(t)},onMutate:async t=>{await e.cancelQueries({queryKey:o.aiChatKeys.all()});const n=e.getQueryData(o.aiChatKeys.all());n&&e.setQueryData(o.aiChatKeys.all(),n.filter(s=>s.id!==t)),e.setQueryData(o.aiChatKeys.detail(t),null),e.setQueriesData({queryKey:o.aiChatKeys.infiniteHistories()},s=>s&&{...s,pages:s.pages.map(a=>({...a,items:a.items.filter(r=>r.id!==t)}))})},onError(t){console.error("Failed to remove ai chat:",t)},onSettled(){e.invalidateQueries({queryKey:o.aiChatKeys.all()})}})}var ee,oe;function ve(){if(oe)return ee;oe=1;function e(t,n){if(typeof t!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof t}\`.`);let s,a=0;return function(...l){clearTimeout(s);const c=Date.now(),d=c-a,p=n-d;p<=0?(a=c,t.apply(this,l)):s=setTimeout(()=>{a=Date.now(),t.apply(this,l)},p)}}return ee=e,ee}var we=ve();const Ie=o.getDefaultExportFromCjs(we);var ue=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},h=(e,t,n)=>(ue(e,t,"read from private field"),n?n.call(e):t.get(e)),A=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},R=(e,t,n,s)=>(ue(e,t,"write to private field"),t.set(e,n),n);function Te(e,t){return t!=null?Ie(e,t):e}var w,Y,J,j,Q,V,W,ne,se,ye=class{constructor(e=[]){A(this,w,void 0),A(this,Y,"ready"),A(this,J,void 0),A(this,j,new Set),A(this,Q,new Set),A(this,V,new Set),this.pushMessage=t=>{R(this,w,h(this,w).concat(t)),h(this,W).call(this)},this.popMessage=()=>{R(this,w,h(this,w).slice(0,-1)),h(this,W).call(this)},this.replaceMessage=(t,n)=>{R(this,w,[...h(this,w).slice(0,t),this.snapshot(n),...h(this,w).slice(t+1)]),h(this,W).call(this)},this.snapshot=t=>structuredClone(t),this["~registerMessagesCallback"]=(t,n)=>{const s=n?Te(t,n):t;return h(this,j).add(s),()=>{h(this,j).delete(s)}},this["~registerStatusCallback"]=t=>(h(this,Q).add(t),()=>{h(this,Q).delete(t)}),this["~registerErrorCallback"]=t=>(h(this,V).add(t),()=>{h(this,V).delete(t)}),A(this,W,()=>{h(this,j).forEach(t=>t())}),A(this,ne,()=>{h(this,Q).forEach(t=>t())}),A(this,se,()=>{h(this,V).forEach(t=>t())}),R(this,w,e)}get status(){return h(this,Y)}set status(e){R(this,Y,e),h(this,ne).call(this)}get error(){return h(this,J)}set error(e){R(this,J,e),h(this,se).call(this)}get messages(){return h(this,w)}set messages(e){R(this,w,[...e]),h(this,W).call(this)}};w=new WeakMap;Y=new WeakMap;J=new WeakMap;j=new WeakMap;Q=new WeakMap;V=new WeakMap;W=new WeakMap;ne=new WeakMap;se=new WeakMap;var U,ae=class extends te.AbstractChat{constructor({messages:e,...t}){const n=new ye(e);super({...t,state:n}),A(this,U,void 0),this["~registerMessagesCallback"]=(s,a)=>h(this,U)["~registerMessagesCallback"](s,a),this["~registerStatusCallback"]=s=>h(this,U)["~registerStatusCallback"](s),this["~registerErrorCallback"]=s=>h(this,U)["~registerErrorCallback"](s),R(this,U,n)}};U=new WeakMap;function Ae({experimental_throttle:e,resume:t=!1,...n}={}){const s=i.useRef("chat"in n?{}:{onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});"chat"in n||(s.current={onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});const a={...n,onToolCall:u=>{var g,f;return(f=(g=s.current).onToolCall)==null?void 0:f.call(g,u)},onData:u=>{var g,f;return(f=(g=s.current).onData)==null?void 0:f.call(g,u)},onFinish:u=>{var g,f;return(f=(g=s.current).onFinish)==null?void 0:f.call(g,u)},onError:u=>{var g,f;return(f=(g=s.current).onError)==null?void 0:f.call(g,u)},sendAutomaticallyWhen:u=>{var g,f,_;return(_=(f=(g=s.current).sendAutomaticallyWhen)==null?void 0:f.call(g,u))!=null?_:!1}},r=i.useRef("chat"in n?n.chat:new ae(a));("chat"in n&&n.chat!==r.current||"id"in n&&n.id!=null&&r.current.id!==n.id)&&(r.current="chat"in n?n.chat:new ae(a));const c=i.useCallback(u=>r.current["~registerMessagesCallback"](u,e),[e,r.current.id]),d=i.useSyncExternalStore(c,()=>r.current.messages,()=>r.current.messages),p=i.useSyncExternalStore(r.current["~registerStatusCallback"],()=>r.current.status,()=>r.current.status),I=i.useSyncExternalStore(r.current["~registerErrorCallback"],()=>r.current.error,()=>r.current.error),T=i.useCallback(u=>{typeof u=="function"&&(u=u(r.current.messages)),r.current.messages=u},[r]);return i.useEffect(()=>{t&&r.current.resumeStream()},[t,r]),{id:r.current.id,messages:d,setMessages:T,sendMessage:r.current.sendMessage,regenerate:r.current.regenerate,clearError:r.current.clearError,stop:r.current.stop,error:I,resumeStream:r.current.resumeStream,status:p,addToolResult:r.current.addToolOutput,addToolOutput:r.current.addToolOutput,addToolApprovalResponse:r.current.addToolApprovalResponse}}const be=20;function Se(e){if(e.length===0)return"No OpenAPI specs loaded.";const t=e.slice(0,be),n=t.map(ke),s=e.length-t.length;return s>0&&n.push(` …and ${s} more API(s) not shown.`),[`Loaded APIs (${e.length}):`,...n].join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("react/jsx-runtime"),i=require("react"),o=require("./replay-index-DYtXcqDk.js"),te=require("./replay-create-model-Bw20x80b.js"),fe=require("./replay-agent-loop-Z_nrrmg_.js"),pe=require("./replay-db-BQXljNM0.js"),v=require("./replay-useAiChatQueries-Bypgnkwa.js"),B=require("@tanstack/react-query"),Z=require("./replay-ai-chat-mappers-aJ_VMb6Z.js");class ge{handlers=new Map;middlewares;constructor(t){this.middlewares=t?.middlewares??[]}register(t){this.handlers.set(t.name,t)}getToolSet(){const t={};for(const[n,s]of this.handlers)t[n]=this.buildTool(s);return t}buildTool(t){return{...t.definition,execute:this.wrapExecutor(t)}}wrapExecutor(t){const n=(a,r)=>({isError:!0,error:{message:a,details:r}}),s=this.applyMiddlewares(t.name,t.execute);return(a,r)=>{if(r.abortSignal?.aborted)return n("Tool execution was aborted.");try{const l=s(a,r);return typeof l=="object"&&l!==null&&"then"in l?l.then(c=>c,c=>n(c instanceof Error?c.message:"Unknown tool execution error")):l}catch(l){return n(l instanceof Error?l.message:"Unknown tool execution error")}}}applyMiddlewares(t,n){return this.middlewares.length===0?n:this.middlewares.reduceRight((s,a)=>a(t,s),n)}}function ce(){const e=B.useQueryClient();return B.useMutation({async mutationFn(t){const n=Z.buildPersistableUiChat(t);await o.AiChatServiceFactory.getInstance().upsert(n)},onSuccess(){e.invalidateQueries({queryKey:o.aiChatKeys.all()})},onError(t){console.error("Failed to upsert ai chat item:",t)}})}function Ce(e){const t=B.useQueryClient(),n=o.aiChatKeys.detailTitle(e??"");return B.useMutation({mutationKey:n,async mutationFn(s){if(t.isMutating({mutationKey:n,exact:!0})>1)return;const a=Z.buildPersistableUiChat(s);await o.AiChatServiceFactory.getInstance().upsert(a)},onSuccess(){t.invalidateQueries({queryKey:o.aiChatKeys.all()})},onError(s){console.error("Failed to upsert ai chat item:",s)}})}function me(){const e=B.useQueryClient();return B.useMutation({async mutationFn(t){await o.AiChatServiceFactory.getInstance().remove(t)},onMutate:async t=>{await e.cancelQueries({queryKey:o.aiChatKeys.all()});const n=e.getQueryData(o.aiChatKeys.all());n&&e.setQueryData(o.aiChatKeys.all(),n.filter(s=>s.id!==t)),e.setQueryData(o.aiChatKeys.detail(t),null),e.setQueriesData({queryKey:o.aiChatKeys.infiniteHistories()},s=>s&&{...s,pages:s.pages.map(a=>({...a,items:a.items.filter(r=>r.id!==t)}))})},onError(t){console.error("Failed to remove ai chat:",t)},onSettled(){e.invalidateQueries({queryKey:o.aiChatKeys.all()})}})}var ee,oe;function ve(){if(oe)return ee;oe=1;function e(t,n){if(typeof t!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof t}\`.`);let s,a=0;return function(...l){clearTimeout(s);const c=Date.now(),d=c-a,p=n-d;p<=0?(a=c,t.apply(this,l)):s=setTimeout(()=>{a=Date.now(),t.apply(this,l)},p)}}return ee=e,ee}var we=ve();const Ie=o.getDefaultExportFromCjs(we);var ue=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},h=(e,t,n)=>(ue(e,t,"read from private field"),n?n.call(e):t.get(e)),A=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},R=(e,t,n,s)=>(ue(e,t,"write to private field"),t.set(e,n),n);function Te(e,t){return t!=null?Ie(e,t):e}var w,Y,J,j,Q,V,W,ne,se,ye=class{constructor(e=[]){A(this,w,void 0),A(this,Y,"ready"),A(this,J,void 0),A(this,j,new Set),A(this,Q,new Set),A(this,V,new Set),this.pushMessage=t=>{R(this,w,h(this,w).concat(t)),h(this,W).call(this)},this.popMessage=()=>{R(this,w,h(this,w).slice(0,-1)),h(this,W).call(this)},this.replaceMessage=(t,n)=>{R(this,w,[...h(this,w).slice(0,t),this.snapshot(n),...h(this,w).slice(t+1)]),h(this,W).call(this)},this.snapshot=t=>structuredClone(t),this["~registerMessagesCallback"]=(t,n)=>{const s=n?Te(t,n):t;return h(this,j).add(s),()=>{h(this,j).delete(s)}},this["~registerStatusCallback"]=t=>(h(this,Q).add(t),()=>{h(this,Q).delete(t)}),this["~registerErrorCallback"]=t=>(h(this,V).add(t),()=>{h(this,V).delete(t)}),A(this,W,()=>{h(this,j).forEach(t=>t())}),A(this,ne,()=>{h(this,Q).forEach(t=>t())}),A(this,se,()=>{h(this,V).forEach(t=>t())}),R(this,w,e)}get status(){return h(this,Y)}set status(e){R(this,Y,e),h(this,ne).call(this)}get error(){return h(this,J)}set error(e){R(this,J,e),h(this,se).call(this)}get messages(){return h(this,w)}set messages(e){R(this,w,[...e]),h(this,W).call(this)}};w=new WeakMap;Y=new WeakMap;J=new WeakMap;j=new WeakMap;Q=new WeakMap;V=new WeakMap;W=new WeakMap;ne=new WeakMap;se=new WeakMap;var U,ae=class extends te.AbstractChat{constructor({messages:e,...t}){const n=new ye(e);super({...t,state:n}),A(this,U,void 0),this["~registerMessagesCallback"]=(s,a)=>h(this,U)["~registerMessagesCallback"](s,a),this["~registerStatusCallback"]=s=>h(this,U)["~registerStatusCallback"](s),this["~registerErrorCallback"]=s=>h(this,U)["~registerErrorCallback"](s),R(this,U,n)}};U=new WeakMap;function Ae({experimental_throttle:e,resume:t=!1,...n}={}){const s=i.useRef("chat"in n?{}:{onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});"chat"in n||(s.current={onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});const a={...n,onToolCall:u=>{var g,f;return(f=(g=s.current).onToolCall)==null?void 0:f.call(g,u)},onData:u=>{var g,f;return(f=(g=s.current).onData)==null?void 0:f.call(g,u)},onFinish:u=>{var g,f;return(f=(g=s.current).onFinish)==null?void 0:f.call(g,u)},onError:u=>{var g,f;return(f=(g=s.current).onError)==null?void 0:f.call(g,u)},sendAutomaticallyWhen:u=>{var g,f,_;return(_=(f=(g=s.current).sendAutomaticallyWhen)==null?void 0:f.call(g,u))!=null?_:!1}},r=i.useRef("chat"in n?n.chat:new ae(a));("chat"in n&&n.chat!==r.current||"id"in n&&n.id!=null&&r.current.id!==n.id)&&(r.current="chat"in n?n.chat:new ae(a));const c=i.useCallback(u=>r.current["~registerMessagesCallback"](u,e),[e,r.current.id]),d=i.useSyncExternalStore(c,()=>r.current.messages,()=>r.current.messages),p=i.useSyncExternalStore(r.current["~registerStatusCallback"],()=>r.current.status,()=>r.current.status),I=i.useSyncExternalStore(r.current["~registerErrorCallback"],()=>r.current.error,()=>r.current.error),T=i.useCallback(u=>{typeof u=="function"&&(u=u(r.current.messages)),r.current.messages=u},[r]);return i.useEffect(()=>{t&&r.current.resumeStream()},[t,r]),{id:r.current.id,messages:d,setMessages:T,sendMessage:r.current.sendMessage,regenerate:r.current.regenerate,clearError:r.current.clearError,stop:r.current.stop,error:I,resumeStream:r.current.resumeStream,status:p,addToolResult:r.current.addToolOutput,addToolOutput:r.current.addToolOutput,addToolApprovalResponse:r.current.addToolApprovalResponse}}const be=20;function Se(e){if(e.length===0)return"No OpenAPI specs loaded.";const t=e.slice(0,be),n=t.map(ke),s=e.length-t.length;return s>0&&n.push(` …and ${s} more API(s) not shown.`),[`Loaded APIs (${e.length}):`,...n].join(`
2
2
  `)}function ke(e){return[` apiId="${e.apiId}"`,`title="${e.title}"`,e.version?`version="${e.version}"`:null,e.primaryServer?`server="${e.primaryServer}"`:null].filter(Boolean).join(" ")}const Ee=30;function Me(e){if(e.length===0)return"No Arazzo collections loaded.";const t=[`Arazzo collections (${e.length}):`];let n=Ee,s=0,a=0;for(const l of e){if(n<=0){s+=l.workflows.length,a++;continue}if(t.push(Re(l)),n--,l.workflows.length===0)t.push(" (no workflows)");else if(n>=2){t.push(` workflows (${l.workflows.length}):`),n--;for(const c of l.workflows)n>0?(t.push(` ${_e(c)}`),n--):s++}else s+=l.workflows.length}const r=[s>0?`${s} more workflow(s)`:null,a>0?`${a} more collection(s)`:null].filter(Boolean);return r.length>0&&t.push(` …and ${r.join(", plus ")} not shown.`),t.join(`
3
3
  `)}function Re(e){const t=e.sourceApiIds.length>0?` apis=[${e.sourceApiIds.join(", ")}]`:"";return` collectionId="${e.collectionId}" title="${e.title}"${t}`}function _e(e){const t=`id="${e.workflowId}"`,n=e.summary?`label="${e.summary}"`:null,s=`[${e.stepCount} step${e.stepCount!==1?"s":""}]`;return[t,n,s].filter(Boolean).join(" ")}const Pe=20;function De(e){if(e.length===0)return"No environments configured.";const t=e.slice(0,Pe),n=t.map(xe),s=e.length-t.length;return s>0&&n.push(` …and ${s} more environment(s) not shown.`),[`Environments (${e.length}); * marks the active environment:`,...n].join(`
4
4
  `)}function xe(e){return[`${e.isActive?"*":" "} name="${e.name}"`,`inputs=${e.inputCount}`,`servers=${e.serverCount}`].join(" ")}const $e=30;function Oe(e){if(e.length===0)return"No tabs are open.";const t=e.slice(0,$e),n=t.map(We),s=e.length-t.length;return s>0&&n.push(` …and ${s} more tab(s) not shown.`),[`Open tabs (${e.length}), listed by tabIndex; * marks the active (focused) tab:`,...n].join(`
@@ -1,12 +1,12 @@
1
1
  import { jsx as te } from "react/jsx-runtime";
2
2
  import { useRef as W, useCallback as f, useSyncExternalStore as re, useEffect as k, useMemo as w, useState as z } from "react";
3
- import { k as S, A as ce, g as _e, I as Re, T as $e, m as $, n as Pe, o as xe, h as De, p as We, q as Be, j as Oe, s as Ue, u as Fe, v as Le, w as je, x as fe, z as Ne, B as Ke, C as qe, E as Ae, F as se, G as ue, H as Te, J as Qe, K as Ve, L as Ge, N as ye, O as ge, Q as He, U as ne, V as ze, W as ae, X as Ye, Y as Je } from "./replay-index-B-Z3hRlH.js";
4
- import { A as Xe, D as Ze, l as et } from "./replay-create-model-DgfhU1ps.js";
5
- import { AgentLoop as tt } from "./replay-agent-loop-Bv3OEM5Y.js";
6
- import { s as nt } from "./replay-db-D3MZ3YVw.js";
7
- import { r as st, g as rt, a as ot, o as at, s as it, w as lt, m as ct, b as ut, u as dt, c as ht, d as pt, e as ft, f as gt, h as mt, i as vt, A as wt, j as Ct, k as It } from "./replay-useAiChatQueries-DFd8ZJQG.js";
3
+ import { Z as S, _ as ce, J as _e, $ as Re, a0 as $e, a1 as $, a2 as Pe, a3 as xe, c as De, a4 as We, a5 as Be, a as Oe, a6 as Ue, a7 as Fe, a8 as Le, a9 as je, aa as fe, ab as Ne, ac as Ke, ad as qe, ae as Ae, af as se, ag as ue, ah as Te, ai as Qe, aj as Ve, ak as Ge, al as ye, y as ge, z as He, R as ne, am as ze, an as ae, ao as Ye, ap as Je } from "./replay-index-BCz452N6.js";
4
+ import { A as Ze, D as Xe, l as et } from "./replay-create-model-Be3vPVDb.js";
5
+ import { AgentLoop as tt } from "./replay-agent-loop-B8Mjb8DU.js";
6
+ import { s as nt } from "./replay-db-BmZNrdZM.js";
7
+ import { r as st, g as rt, a as ot, o as at, s as it, w as lt, m as ct, b as ut, u as dt, c as ht, d as pt, e as ft, f as gt, h as mt, i as vt, A as wt, j as Ct, k as It } from "./replay-useAiChatQueries-S6v5duiJ.js";
8
8
  import { useQueryClient as de, useMutation as he } from "@tanstack/react-query";
9
- import { b as Se, g as me } from "./replay-ai-chat-mappers-Kj9YEXwF.js";
9
+ import { d as Se, g as me } from "./replay-ai-chat-mappers-D7e8buTk.js";
10
10
  class At {
11
11
  handlers = /* @__PURE__ */ new Map();
12
12
  middlewares;
@@ -146,12 +146,12 @@ var be = (e, t, n) => {
146
146
  throw TypeError("Cannot add the same private member more than once");
147
147
  t instanceof WeakSet ? t.add(e) : t.set(e, n);
148
148
  }, R = (e, t, n, s) => (be(e, t, "write to private field"), t.set(e, n), n);
149
- function Et(e, t) {
149
+ function Mt(e, t) {
150
150
  return t != null ? bt(e, t) : e;
151
151
  }
152
- var v, Z, ee, V, G, H, F, ie, le, Mt = class {
152
+ var v, X, ee, V, G, H, F, ie, le, Et = class {
153
153
  constructor(e = []) {
154
- T(this, v, void 0), T(this, Z, "ready"), T(this, ee, void 0), T(this, V, /* @__PURE__ */ new Set()), T(this, G, /* @__PURE__ */ new Set()), T(this, H, /* @__PURE__ */ new Set()), this.pushMessage = (t) => {
154
+ T(this, v, void 0), T(this, X, "ready"), T(this, ee, void 0), T(this, V, /* @__PURE__ */ new Set()), T(this, G, /* @__PURE__ */ new Set()), T(this, H, /* @__PURE__ */ new Set()), this.pushMessage = (t) => {
155
155
  R(this, v, u(this, v).concat(t)), u(this, F).call(this);
156
156
  }, this.popMessage = () => {
157
157
  R(this, v, u(this, v).slice(0, -1)), u(this, F).call(this);
@@ -163,7 +163,7 @@ var v, Z, ee, V, G, H, F, ie, le, Mt = class {
163
163
  ...u(this, v).slice(t + 1)
164
164
  ]), u(this, F).call(this);
165
165
  }, this.snapshot = (t) => structuredClone(t), this["~registerMessagesCallback"] = (t, n) => {
166
- const s = n ? Et(t, n) : t;
166
+ const s = n ? Mt(t, n) : t;
167
167
  return u(this, V).add(s), () => {
168
168
  u(this, V).delete(s);
169
169
  };
@@ -180,10 +180,10 @@ var v, Z, ee, V, G, H, F, ie, le, Mt = class {
180
180
  }), R(this, v, e);
181
181
  }
182
182
  get status() {
183
- return u(this, Z);
183
+ return u(this, X);
184
184
  }
185
185
  set status(e) {
186
- R(this, Z, e), u(this, ie).call(this);
186
+ R(this, X, e), u(this, ie).call(this);
187
187
  }
188
188
  get error() {
189
189
  return u(this, ee);
@@ -199,7 +199,7 @@ var v, Z, ee, V, G, H, F, ie, le, Mt = class {
199
199
  }
200
200
  };
201
201
  v = /* @__PURE__ */ new WeakMap();
202
- Z = /* @__PURE__ */ new WeakMap();
202
+ X = /* @__PURE__ */ new WeakMap();
203
203
  ee = /* @__PURE__ */ new WeakMap();
204
204
  V = /* @__PURE__ */ new WeakMap();
205
205
  G = /* @__PURE__ */ new WeakMap();
@@ -207,9 +207,9 @@ H = /* @__PURE__ */ new WeakMap();
207
207
  F = /* @__PURE__ */ new WeakMap();
208
208
  ie = /* @__PURE__ */ new WeakMap();
209
209
  le = /* @__PURE__ */ new WeakMap();
210
- var L, we = class extends Xe {
210
+ var L, we = class extends Ze {
211
211
  constructor({ messages: e, ...t }) {
212
- const n = new Mt(e);
212
+ const n = new Et(e);
213
213
  super({ ...t, state: n }), T(this, L, void 0), this["~registerMessagesCallback"] = (s, o) => u(this, L)["~registerMessagesCallback"](s, o), this["~registerStatusCallback"] = (s) => u(this, L)["~registerStatusCallback"](s), this["~registerErrorCallback"] = (s) => u(this, L)["~registerErrorCallback"](s), R(this, L, n);
214
214
  }
215
215
  };
@@ -471,7 +471,7 @@ function Jt(e, t, n, s) {
471
471
  const { collectionId: r } = t.data;
472
472
  return {
473
473
  ...o,
474
- label: Xt(e, r) ?? r,
474
+ label: Zt(e, r) ?? r,
475
475
  collectionId: r
476
476
  };
477
477
  }
@@ -493,7 +493,7 @@ function Jt(e, t, n, s) {
493
493
  const r = t.data;
494
494
  return {
495
495
  ...o,
496
- label: Zt(r),
496
+ label: Xt(r),
497
497
  collectionId: r.collectionId,
498
498
  workflowId: r.workflowId,
499
499
  stepId: r.stepId,
@@ -504,10 +504,10 @@ function Jt(e, t, n, s) {
504
504
  }
505
505
  }
506
506
  }
507
- function Xt(e, t) {
507
+ function Zt(e, t) {
508
508
  return e.find((n) => n.id === t)?.info.title;
509
509
  }
510
- function Zt(e) {
510
+ function Xt(e) {
511
511
  if (e.stepId)
512
512
  return e.stepId;
513
513
  if (e.draftStep) {
@@ -644,9 +644,9 @@ function an(e) {
644
644
  I.current = h, l.current = s;
645
645
  const g = w(() => {
646
646
  x.current?.end();
647
- const M = ge.getTracer("replay-ai-chat").startSpan("ai.chat.session", { attributes: { conversation_id: n } });
648
- x.current = M;
649
- const _ = ge.setSpan(He.active(), M);
647
+ const E = ge.getTracer("replay-ai-chat").startSpan("ai.chat.session", { attributes: { conversation_id: n } });
648
+ x.current = E;
649
+ const _ = ge.setSpan(He.active(), E);
650
650
  return new tt({
651
651
  activeConversationId: n,
652
652
  model: l.current,
@@ -659,7 +659,7 @@ function an(e) {
659
659
  k(() => () => x.current?.end(), []);
660
660
  const B = w(() => {
661
661
  if (g)
662
- return new Ze({ agent: g.getAgent() });
662
+ return new Xe({ agent: g.getAgent() });
663
663
  }, [g]);
664
664
  k(() => {
665
665
  g.setModel(s);
@@ -670,7 +670,7 @@ function an(e) {
670
670
  messages: b,
671
671
  setMessages: D,
672
672
  sendMessage: N,
673
- status: E,
673
+ status: M,
674
674
  error: Y,
675
675
  stop: O,
676
676
  addToolApprovalResponse: K
@@ -679,17 +679,17 @@ function an(e) {
679
679
  messages: o,
680
680
  transport: B,
681
681
  sendAutomaticallyWhen: et,
682
- onFinish(M) {
682
+ onFinish(E) {
683
683
  if (!r || !g) return;
684
- r({ agentLoop: g, chat: this }, M);
684
+ r({ agentLoop: g, chat: this }, E);
685
685
  }
686
- }), y = w(() => E === "streaming" || E === "submitted", [E]), q = f(() => {
686
+ }), y = w(() => M === "streaming" || M === "submitted", [M]), q = f(() => {
687
687
  i.aiEnabled === !0 && d();
688
688
  }, [d, i.aiEnabled]), Q = f(() => {
689
689
  P();
690
690
  }, [P]), J = f(
691
- async (M) => {
692
- const _ = M.trim();
691
+ async (E) => {
692
+ const _ = E.trim();
693
693
  if (!(!_ || !B)) {
694
694
  if (s.provider === ne) {
695
695
  const A = await c?.();
@@ -712,18 +712,18 @@ function an(e) {
712
712
  O();
713
713
  }, [n, O]);
714
714
  const U = f(
715
- (M) => {
716
- const _ = M(b), A = _.map((X) => X.message), pe = [...b];
717
- for (const X of _)
718
- pe[X.index] = X.message;
715
+ (E) => {
716
+ const _ = E(b), A = _.map((Z) => Z.message), pe = [...b];
717
+ for (const Z of _)
718
+ pe[Z.index] = Z.message;
719
719
  D(pe), a?.(A);
720
720
  },
721
721
  [b, a, D]
722
- ), Ee = w(
722
+ ), Me = w(
723
723
  () => ({
724
724
  messages: b,
725
725
  isStreaming: y,
726
- chatStatus: E,
726
+ chatStatus: M,
727
727
  chatError: Y,
728
728
  sendMessage: J,
729
729
  updateMessages: U,
@@ -736,11 +736,11 @@ function an(e) {
736
736
  y,
737
737
  b,
738
738
  J,
739
- E,
739
+ M,
740
740
  m,
741
741
  U
742
742
  ]
743
- ), Me = w(
743
+ ), Ee = w(
744
744
  () => ({
745
745
  isOpen: p,
746
746
  openPanel: q,
@@ -748,7 +748,7 @@ function an(e) {
748
748
  }),
749
749
  [p, q, Q]
750
750
  );
751
- return /* @__PURE__ */ te(wt.Provider, { value: Ee, children: /* @__PURE__ */ te(ze.Provider, { value: Me, children: t }) });
751
+ return /* @__PURE__ */ te(wt.Provider, { value: Me, children: /* @__PURE__ */ te(ze.Provider, { value: Ee, children: t }) });
752
752
  }
753
753
  function ln(e) {
754
754
  return e.slice(-2);
@@ -927,15 +927,15 @@ function _n(e) {
927
927
  availableModels: x,
928
928
  aiProviders: h.aiProviders,
929
929
  reuniteAuth: P
930
- }), b = yt(), D = hn({ chatId: n, model: g }), N = pn({ chatId: n, model: g }), E = dn({
930
+ }), b = yt(), D = hn({ chatId: n, model: g }), N = pn({ chatId: n, model: g }), M = dn({
931
931
  chatId: n,
932
932
  model: g,
933
933
  existingTitle: d?.title
934
934
  }), Y = f(
935
935
  (m, U) => {
936
- U.isAbort || (D(m, U), E(m, U));
936
+ U.isAbort || (D(m, U), M(m, U));
937
937
  },
938
- [D, E]
938
+ [D, M]
939
939
  ), O = f(
940
940
  (...m) => {
941
941
  N(...m);
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./replay-history.schema-miM3Etuf.js");require("./replay-step-context.schema-BuuXkAck.js");const i=require("./replay-ai-message-parts.schema-BBdjwldJ.js"),h=require("./replay-ai-chat-mappers-CknwkJ22.js"),s=require("./replay-indexes-Dqjl8m6C.js"),c={orderBy:[s.asc(i.aiMessages.createdAt),s.asc(i.aiMessages.indexWithinInsertBatch)],with:{parts:{orderBy:[s.asc(i.aiMessageParts.index)]}}};class g{constructor(e){this.sqliteDB=e}sqliteDB;async findAll(){return await this.initialize(),(await this.db.query.aiChats.findMany({with:{messages:c}})).map(h.convertAiChatRowToUiChat)}async findRecentChatsPage(e){await this.initialize();const a=e.limit+1,r=await this.db.query.aiChats.findMany({orderBy:(d,{desc:o})=>o(d.updatedAt),limit:a,offset:e.offset}),t=r.slice(0,e.limit),n=r.length>e.limit,w=e.offset+t.length;return{items:t.map(d=>{const o={...d,messages:[]};return h.convertAiChatRowToUiChat(o)}),hasMore:n,nextOffset:w}}async findOne(e){await this.initialize();const a=await this.db.query.aiChats.findFirst({where:s.eq(i.aiChats.id,e),with:{messages:c}});return a&&h.convertAiChatRowToUiChat(a)}async upsert(e){await this.initialize();const a=h.convertUiChatToAiChatRow(e);await this.db.query.aiChats.findFirst({where:s.eq(i.aiChats.id,a.id),columns:{id:!0}})?await this.db.update(i.aiChats).set(a).where(s.eq(i.aiChats.id,a.id)):await this.db.insert(i.aiChats).values(a);for(let t=0;t<e.messages.length;t++)await this.upsertMessageRowAndParts(e.id,t,e.messages[t])}async remove(e){await this.initialize(),await this.db.delete(i.aiChats).where(s.eq(i.aiChats.id,e))}async upsertMessageRowAndParts(e,a,r){const t=await this.db.query.aiMessages.findFirst({where:s.and(s.eq(i.aiMessages.aiChatId,e),s.eq(i.aiMessages.uiId,r.id))}),n=h.convertUiMessageToAiChatMessage(e,a,r,t?.id);t?await this.db.update(i.aiMessages).set({...n,indexWithinInsertBatch:t.indexWithinInsertBatch}).where(s.eq(i.aiMessages.id,t.id)):await this.db.insert(i.aiMessages).values(n),await this.db.delete(i.aiMessageParts).where(s.eq(i.aiMessageParts.aiMessageId,n.id)),n.parts.length>0&&await this.db.insert(i.aiMessageParts).values(n.parts)}get db(){return this.sqliteDB.db}async initialize(){await this.sqliteDB.initialize()}}exports.AiChatSqliteDBStorage=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./replay-history.schema-miM3Etuf.js");require("./replay-step-context.schema-BuuXkAck.js");const i=require("./replay-ai-message-parts.schema-BBdjwldJ.js"),h=require("./replay-ai-chat-mappers-aJ_VMb6Z.js"),s=require("./replay-indexes-Dqjl8m6C.js"),c={orderBy:[s.asc(i.aiMessages.createdAt),s.asc(i.aiMessages.indexWithinInsertBatch)],with:{parts:{orderBy:[s.asc(i.aiMessageParts.index)]}}};class g{constructor(e){this.sqliteDB=e}sqliteDB;async findAll(){return await this.initialize(),(await this.db.query.aiChats.findMany({with:{messages:c}})).map(h.convertAiChatRowToUiChat)}async findRecentChatsPage(e){await this.initialize();const a=e.limit+1,r=await this.db.query.aiChats.findMany({orderBy:(d,{desc:o})=>o(d.updatedAt),limit:a,offset:e.offset}),t=r.slice(0,e.limit),n=r.length>e.limit,w=e.offset+t.length;return{items:t.map(d=>{const o={...d,messages:[]};return h.convertAiChatRowToUiChat(o)}),hasMore:n,nextOffset:w}}async findOne(e){await this.initialize();const a=await this.db.query.aiChats.findFirst({where:s.eq(i.aiChats.id,e),with:{messages:c}});return a&&h.convertAiChatRowToUiChat(a)}async upsert(e){await this.initialize();const a=h.convertUiChatToAiChatRow(e);await this.db.query.aiChats.findFirst({where:s.eq(i.aiChats.id,a.id),columns:{id:!0}})?await this.db.update(i.aiChats).set(a).where(s.eq(i.aiChats.id,a.id)):await this.db.insert(i.aiChats).values(a);for(let t=0;t<e.messages.length;t++)await this.upsertMessageRowAndParts(e.id,t,e.messages[t])}async remove(e){await this.initialize(),await this.db.delete(i.aiChats).where(s.eq(i.aiChats.id,e))}async upsertMessageRowAndParts(e,a,r){const t=await this.db.query.aiMessages.findFirst({where:s.and(s.eq(i.aiMessages.aiChatId,e),s.eq(i.aiMessages.uiId,r.id))}),n=h.convertUiMessageToAiChatMessage(e,a,r,t?.id);t?await this.db.update(i.aiMessages).set({...n,indexWithinInsertBatch:t.indexWithinInsertBatch}).where(s.eq(i.aiMessages.id,t.id)):await this.db.insert(i.aiMessages).values(n),await this.db.delete(i.aiMessageParts).where(s.eq(i.aiMessageParts.aiMessageId,n.id)),n.parts.length>0&&await this.db.insert(i.aiMessageParts).values(n.parts)}get db(){return this.sqliteDB.db}async initialize(){await this.sqliteDB.initialize()}}exports.AiChatSqliteDBStorage=g;
@@ -1,8 +1,8 @@
1
- import "./replay-history.schema-5ce6X0R1.js";
2
- import "./replay-step-context.schema-DBk4jufr.js";
3
- import { a as h, b as r, c as n } from "./replay-ai-message-parts.schema-E9u9-nqr.js";
4
- import { c, a as u, d as m } from "./replay-ai-chat-mappers-Kj9YEXwF.js";
5
- import { a as l, e, b as y } from "./replay-indexes-CfsvVMi_.js";
1
+ import "./replay-history.schema-B0lLwmdG.js";
2
+ import "./replay-step-context.schema-BOprzd6Z.js";
3
+ import { a as h, b as r, c as n } from "./replay-ai-message-parts.schema-DKLf0SiG.js";
4
+ import { c, a as u, b as m } from "./replay-ai-chat-mappers-D7e8buTk.js";
5
+ import { b as l, e, c as b } from "./replay-indexes-B3PJtgeh.js";
6
6
  const g = {
7
7
  orderBy: [l(r.createdAt), l(r.indexWithinInsertBatch)],
8
8
  with: {
@@ -64,7 +64,7 @@ class A {
64
64
  }
65
65
  async upsertMessageRowAndParts(i, s, d) {
66
66
  const t = await this.db.query.aiMessages.findFirst({
67
- where: y(e(r.aiChatId, i), e(r.uiId, d.id))
67
+ where: b(e(r.aiChatId, i), e(r.uiId, d.id))
68
68
  }), a = m(
69
69
  i,
70
70
  s,
@@ -1,14 +1,14 @@
1
- import { jsxs as m, jsx as i, Fragment as Fe } from "react/jsx-runtime";
2
- import { useCallback as _, useMemo as A, useState as q, Fragment as ht, useRef as N, useEffect as B, useLayoutEffect as je } from "react";
1
+ import { jsxs as m, jsx as i, Fragment as Ne } from "react/jsx-runtime";
2
+ import { useCallback as _, useMemo as A, useState as q, Fragment as ht, useRef as F, useEffect as B, useLayoutEffect as je } from "react";
3
3
  import c, { css as ue } from "styled-components";
4
- import { T as be, ac as Ce, ad as mt, ae as gt, E as vt, c as yt, af as fe, ag as pe, ah as V, ai as xe, aj as xt, ak as wt, al as ke, h as bt, am as Ct, an as Ue, ao as kt, ap as Tt, U as he, a2 as le, aq as We, N as Ye, ar as we, as as U, at as It } from "./replay-index-B-Z3hRlH.js";
5
- import { l as At, n as St, p as Lt, q as Pt, T as Et, t as Rt, v as Ot, x as qe, C as I, y as Dt, z as Ge, L as Mt, B as Q, D as _t, E as zt, F as Vt, G as $t, H as F } from "./replay-useAiChatQueries-DFd8ZJQG.js";
4
+ import { a0 as be, aq as Ce, ar as mt, as as gt, ae as vt, q as yt, at as fe, au as pe, S as V, av as xe, aw as xt, ax as wt, ay as ke, c as bt, az as Ct, aA as Ue, aB as kt, aC as Tt, R as he, A as le, aD as We, al as Ye, aE as we, aF as U, aG as It } from "./replay-index-BCz452N6.js";
5
+ import { l as At, n as St, p as Lt, q as Pt, T as Et, t as Rt, v as Ot, x as qe, C as I, y as Dt, z as Ge, L as Mt, B as Q, D as _t, E as zt, F as Vt, G as $t, H as N } from "./replay-useAiChatQueries-S6v5duiJ.js";
6
6
  import { AI_SEARCH_MAX_MESSAGE_LENGTH as Ht } from "@redocly/theme/core/constants/search";
7
7
  import { Button as P } from "@redocly/theme/components/Button/Button";
8
8
  import { SendIcon as Bt } from "@redocly/theme/icons/SendIcon/SendIcon";
9
- import { StopIcon as Nt } from "@redocly/theme/icons/StopIcon/StopIcon";
10
- import { M as z } from "./replay-db-D3MZ3YVw.js";
11
- import { CheckboxIcon as Ft } from "@redocly/theme/icons/CheckboxIcon/CheckboxIcon";
9
+ import { StopIcon as Ft } from "@redocly/theme/icons/StopIcon/StopIcon";
10
+ import { M as z } from "./replay-db-BmZNrdZM.js";
11
+ import { CheckboxIcon as Nt } from "@redocly/theme/icons/CheckboxIcon/CheckboxIcon";
12
12
  import { CheckmarkFilledIcon as jt } from "@redocly/theme/icons/CheckmarkFilledIcon/CheckmarkFilledIcon";
13
13
  import { CloseFilledIcon as Ut } from "@redocly/theme/icons/CloseFilledIcon/CloseFilledIcon";
14
14
  import { AddIcon as Wt } from "@redocly/theme/icons/AddIcon/AddIcon";
@@ -25,7 +25,7 @@ import { ChatGptIcon as Qt } from "@redocly/theme/icons/ChatGptIcon/ChatGptIcon"
25
25
  import { GeminiIcon as en } from "@redocly/theme/icons/GeminiIcon/GeminiIcon";
26
26
  import { ClaudeIcon as tn } from "@redocly/theme/icons/ClaudeIcon/ClaudeIcon";
27
27
  import { Tooltip as W } from "@redocly/theme/components/Tooltip/Tooltip";
28
- import { g as Te } from "./replay-SemanticSearchService-B_97hbQZ.js";
28
+ import { g as Te } from "./replay-SemanticSearchService-BLF1oOOu.js";
29
29
  import "@tanstack/react-query";
30
30
  import { Typography as Z } from "@redocly/theme/components/Typography/Typography";
31
31
  import { TrashCanIcon as nn } from "@redocly/theme/icons/TrashCanIcon/TrashCanIcon";
@@ -78,7 +78,7 @@ function ln({
78
78
  type: "button",
79
79
  size: "small",
80
80
  "aria-label": "Stop generating",
81
- icon: /* @__PURE__ */ i(Nt, { color: "var(--icon-color-on-color)" }),
81
+ icon: /* @__PURE__ */ i(Ft, { color: "var(--icon-color-on-color)" }),
82
82
  onClick: x
83
83
  }
84
84
  ) : /* @__PURE__ */ i(
@@ -638,7 +638,7 @@ function ne(e, t) {
638
638
  function Bn(e) {
639
639
  return e ? "changes" in e ? Array.isArray(e.changes) ? e.changes.map((t) => !t || typeof t != "object" || !("approved" in t) ? !1 : t.approved === !0) : [] : [] : [];
640
640
  }
641
- function Nn(e, t) {
641
+ function Fn(e, t) {
642
642
  if (!e || typeof e != "object") return;
643
643
  const n = ie(e, fe), r = ie(n, pe);
644
644
  if (!(t in r)) return;
@@ -649,7 +649,7 @@ function Nn(e, t) {
649
649
  function Xe(e, t) {
650
650
  return Ot(e) && qe(e) && e.toolCallId === t;
651
651
  }
652
- function Fn(e, t, n) {
652
+ function Nn(e, t, n) {
653
653
  const r = e.parts.map((d) => Xe(d, t) ? { ...d, input: jn(d.input, n) } : d), o = e.metadata && typeof e.metadata == "object" ? e.metadata : {}, a = ie(o, fe), l = { ...ie(a, pe), [t]: yt(n) };
654
654
  return {
655
655
  ...e,
@@ -776,7 +776,7 @@ const qn = c.div`
776
776
  font-weight: var(--font-weight-regular);
777
777
  line-height: var(--line-height-sm);
778
778
  color: var(--text-color-secondary);
779
- `, Xn = c(Ft).attrs({ "aria-hidden": !0 })`
779
+ `, Xn = c(Nt).attrs({ "aria-hidden": !0 })`
780
780
  --checkbox-border-color: var(--color-blueberry-6);
781
781
  --checkbox-box-color: var(--color-blueberry-6);
782
782
  --checkbox-box-color-active: var(--color-blueberry-6);
@@ -1538,7 +1538,7 @@ function _r({
1538
1538
  (O) => Xe(O, e)
1539
1539
  );
1540
1540
  if (S && R) {
1541
- const O = Fn(w, e, s);
1541
+ const O = Nn(w, e, s);
1542
1542
  x.push({ index: b, message: O });
1543
1543
  }
1544
1544
  }
@@ -1567,7 +1567,7 @@ function _r({
1567
1567
  ] }) : null,
1568
1568
  /* @__PURE__ */ i(Br, { size: "small", variant: "secondary", onClick: o, children: h }),
1569
1569
  /* @__PURE__ */ i(
1570
- Nr,
1570
+ Fr,
1571
1571
  {
1572
1572
  size: "small",
1573
1573
  variant: "primary",
@@ -1610,7 +1610,7 @@ const zr = c.div`
1610
1610
  color: var(--text-color-secondary);
1611
1611
  `, Br = c(P)`
1612
1612
  background: none;
1613
- `, Nr = c(P)`
1613
+ `, Fr = c(P)`
1614
1614
  border: 1px solid var(--button-bg-color);
1615
1615
  padding-top: 0;
1616
1616
  padding-bottom: 0;
@@ -1618,7 +1618,7 @@ const zr = c.div`
1618
1618
  border: 1px solid var(--button-border-color-disabled);
1619
1619
  }
1620
1620
  `;
1621
- function Fr({
1621
+ function Nr({
1622
1622
  approvalId: e,
1623
1623
  toolCallId: t,
1624
1624
  toolName: n,
@@ -1649,7 +1649,7 @@ function jr({
1649
1649
  onUndo: a
1650
1650
  }) {
1651
1651
  const s = A(
1652
- () => Nn(o, t),
1652
+ () => Fn(o, t),
1653
1653
  [o, t]
1654
1654
  ), { previews: l } = ot(
1655
1655
  s ? void 0 : e,
@@ -1838,7 +1838,7 @@ function co({
1838
1838
  );
1839
1839
  const { part: o } = n, a = _t(o.type);
1840
1840
  return a && qe(o) ? /* @__PURE__ */ i(
1841
- Fr,
1841
+ Nr,
1842
1842
  {
1843
1843
  approvalId: o.approval.id,
1844
1844
  toolCallId: o.toolCallId,
@@ -2034,7 +2034,7 @@ const Io = c.div`
2034
2034
  max-width: 100%;
2035
2035
  `;
2036
2036
  function Ao(e) {
2037
- const t = N(void 0);
2037
+ const t = F(void 0);
2038
2038
  return B(() => {
2039
2039
  t.current = e;
2040
2040
  }), t.current;
@@ -2122,7 +2122,7 @@ function Eo({
2122
2122
  h.id
2123
2123
  )),
2124
2124
  f && /* @__PURE__ */ i(Be, { "aria-hidden": !0 }),
2125
- u.length > 0 && /* @__PURE__ */ i(Fe, { children: u.map((h) => /* @__PURE__ */ i(
2125
+ u.length > 0 && /* @__PURE__ */ i(Ne, { children: u.map((h) => /* @__PURE__ */ i(
2126
2126
  He,
2127
2127
  {
2128
2128
  model: h,
@@ -2241,14 +2241,14 @@ const Oo = c.div`
2241
2241
  overflow-y: auto;
2242
2242
  `, Bo = c(Ke)`
2243
2243
  flex-shrink: 0;
2244
- `, No = 280;
2244
+ `, Fo = 280;
2245
2245
  function lt({ pinToBottom: e = !1 }) {
2246
2246
  const [t, n] = q(
2247
2247
  () => Te().getIndexingActivityState().inProgress
2248
2248
  );
2249
2249
  return B(() => Te().subscribe("indexing-activity", (o) => {
2250
2250
  n(o.inProgress);
2251
- }), []), /* @__PURE__ */ i(Fo, { $open: t, $pinToBottom: e, "aria-hidden": !t, children: /* @__PURE__ */ i(
2251
+ }), []), /* @__PURE__ */ i(No, { $open: t, $pinToBottom: e, "aria-hidden": !t, children: /* @__PURE__ */ i(
2252
2252
  W,
2253
2253
  {
2254
2254
  tip: "We're building a search index of your project. Until it's ready, the assistant may need more context in each reply to stay accurate, which can use more tokens.",
@@ -2262,7 +2262,7 @@ function lt({ pinToBottom: e = !1 }) {
2262
2262
  }
2263
2263
  ) });
2264
2264
  }
2265
- const Fo = c.div`
2265
+ const No = c.div`
2266
2266
  width: 100%;
2267
2267
  display: block;
2268
2268
 
@@ -2279,7 +2279,7 @@ const Fo = c.div`
2279
2279
  `}
2280
2280
 
2281
2281
  opacity: ${({ $open: e }) => e ? 1 : 0};
2282
- transition: opacity ${No}ms ease-out;
2282
+ transition: opacity ${Fo}ms ease-out;
2283
2283
  pointer-events: ${({ $open: e }) => e ? "auto" : "none"};
2284
2284
 
2285
2285
  ${X} {
@@ -2309,7 +2309,7 @@ function Wo() {
2309
2309
  selectedModelId: a,
2310
2310
  selectModel: s,
2311
2311
  onSettingsOpen: l
2312
- } = We(), { messages: d, isStreaming: u, sendMessage: f, stopGeneration: h } = Q(), { isOpen: p } = Ye(), [y, g] = q(""), x = N(null), b = N(null), w = N(!0), v = d.length > 0, S = t || v, R = Ao(d.length), G = R !== void 0 && R > 0 && !v, $ = _((L = "smooth") => {
2312
+ } = We(), { messages: d, isStreaming: u, sendMessage: f, stopGeneration: h } = Q(), { isOpen: p } = Ye(), [y, g] = q(""), x = F(null), b = F(null), w = F(!0), v = d.length > 0, S = t || v, R = Ao(d.length), G = R !== void 0 && R > 0 && !v, $ = _((L = "smooth") => {
2313
2313
  b.current && b.current.scrollTo({
2314
2314
  top: b.current.scrollHeight,
2315
2315
  behavior: L
@@ -2568,7 +2568,7 @@ function pi() {
2568
2568
  }
2569
2569
  const hi = 50;
2570
2570
  function mi(e) {
2571
- const { onChatSelect: t, onChatRemove: n } = e, r = N(null), o = N(null), { data: a, isPending: s, hasNextPage: l, isFetchingNextPage: d, fetchNextPage: u } = $t(hi), f = A(() => (a?.pages ?? []).flatMap((p) => p.items), [a?.pages]), h = A(() => Xo(f), [f]);
2571
+ const { onChatSelect: t, onChatRemove: n } = e, r = F(null), o = F(null), { data: a, isPending: s, hasNextPage: l, isFetchingNextPage: d, fetchNextPage: u } = $t(hi), f = A(() => (a?.pages ?? []).flatMap((p) => p.items), [a?.pages]), h = A(() => Xo(f), [f]);
2572
2572
  return Zo({
2573
2573
  scrollRef: r,
2574
2574
  sentinelRef: o,
@@ -2591,7 +2591,7 @@ function mi(e) {
2591
2591
  ] });
2592
2592
  }
2593
2593
  function gi() {
2594
- const e = N(null), [t, n] = q(!1);
2594
+ const e = F(null), [t, n] = q(!1);
2595
2595
  return je(() => {
2596
2596
  if (!e.current) return;
2597
2597
  const r = e.current;
@@ -2652,7 +2652,7 @@ const wi = c.div`
2652
2652
  `;
2653
2653
  function ki(e) {
2654
2654
  const { title: t, onCreateNewChat: n, onViewHistory: r, onClose: o } = e;
2655
- return /* @__PURE__ */ m(ut, { buttons: /* @__PURE__ */ m(Fe, { children: [
2655
+ return /* @__PURE__ */ m(ut, { buttons: /* @__PURE__ */ m(Ne, { children: [
2656
2656
  /* @__PURE__ */ i(W, { tip: "New chat", children: /* @__PURE__ */ i(
2657
2657
  P,
2658
2658
  {
@@ -2715,15 +2715,15 @@ const Si = c.div`
2715
2715
  user-select: none;
2716
2716
  `;
2717
2717
  function ma() {
2718
- const [e, t] = q(F.CHAT), n = Ye(), r = We(), o = () => {
2719
- t(F.HISTORY);
2718
+ const [e, t] = q(N.CHAT), n = Ye(), r = We(), o = () => {
2719
+ t(N.HISTORY);
2720
2720
  }, a = () => {
2721
- t(F.CHAT);
2721
+ t(N.CHAT);
2722
2722
  }, s = async (l) => {
2723
- r.selectChat(l), t(F.CHAT);
2723
+ r.selectChat(l), t(N.CHAT);
2724
2724
  };
2725
2725
  return /* @__PURE__ */ m(Li, { children: [
2726
- /* @__PURE__ */ m(Ne, { isActive: e === F.CHAT, children: [
2726
+ /* @__PURE__ */ m(Fe, { isActive: e === N.CHAT, children: [
2727
2727
  /* @__PURE__ */ i(
2728
2728
  ki,
2729
2729
  {
@@ -2735,14 +2735,14 @@ function ma() {
2735
2735
  ),
2736
2736
  /* @__PURE__ */ i(Wo, {})
2737
2737
  ] }),
2738
- /* @__PURE__ */ m(Ne, { isActive: e === F.HISTORY, isSliding: !0, children: [
2738
+ /* @__PURE__ */ m(Fe, { isActive: e === N.HISTORY, isSliding: !0, children: [
2739
2739
  /* @__PURE__ */ i(Ai, { onReturnFromHistory: a }),
2740
2740
  /* @__PURE__ */ i(mi, { onChatSelect: s, onChatRemove: r.removeChat }),
2741
2741
  /* @__PURE__ */ i(Ei, { children: /* @__PURE__ */ i(lt, { pinToBottom: !0 }) })
2742
2742
  ] })
2743
2743
  ] });
2744
2744
  }
2745
- function Ne(e) {
2745
+ function Fe(e) {
2746
2746
  const { children: t, isActive: n, isSliding: r = !1 } = e, o = /* @__PURE__ */ i(Pi, { inert: !n, children: t });
2747
2747
  return r ? /* @__PURE__ */ i(Ri, { $isExpanded: n, children: o }) : o;
2748
2748
  }
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),h=require("react"),X=require("styled-components"),f=require("./replay-index-AEsPADo_.js"),x=require("./replay-useAiChatQueries-DVCG23XB.js"),Ge=require("@redocly/theme/core/constants/search"),E=require("@redocly/theme/components/Button/Button"),Ue=require("@redocly/theme/icons/SendIcon/SendIcon"),We=require("@redocly/theme/icons/StopIcon/StopIcon"),M=require("./replay-db-DjHsvWMQ.js"),Ye=require("@redocly/theme/icons/CheckboxIcon/CheckboxIcon"),Ke=require("@redocly/theme/icons/CheckmarkFilledIcon/CheckmarkFilledIcon"),Je=require("@redocly/theme/icons/CloseFilledIcon/CloseFilledIcon"),Xe=require("@redocly/theme/icons/AddIcon/AddIcon"),Ze=require("@redocly/theme/icons/SubtractIcon/SubtractIcon"),K=require("@redocly/theme/core/utils"),Qe=require("@redocly/theme/icons/ChevronDownIcon/ChevronDownIcon"),et=require("@redocly/theme/icons/ChevronRightIcon/ChevronRightIcon"),tt=require("@redocly/theme/components/Dropdown/Dropdown"),nt=require("@redocly/theme/components/Dropdown/DropdownMenu"),Ie=require("@redocly/theme/components/Dropdown/DropdownMenuItem"),rt=require("@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon"),ot=require("@redocly/theme/icons/SettingsCogIcon/SettingsCogIcon"),it=require("@redocly/theme/icons/ChatGptIcon/ChatGptIcon"),st=require("@redocly/theme/icons/GeminiIcon/GeminiIcon"),at=require("@redocly/theme/icons/ClaudeIcon/ClaudeIcon"),B=require("@redocly/theme/components/Tooltip/Tooltip"),ae=require("./replay-SemanticSearchService-B9YYS_s4.js");require("@tanstack/react-query");const G=require("@redocly/theme/components/Typography/Typography"),lt=require("@redocly/theme/icons/TrashCanIcon/TrashCanIcon"),ct=require("@redocly/theme/icons/AiStarsGradientIcon/AiStarsGradientIcon"),dt=require("@redocly/theme/icons/CloseIcon/CloseIcon"),ut=require("@redocly/theme/icons/NewChatIcon/NewChatIcon"),ft=require("@redocly/theme/icons/RecentlyViewedIcon/RecentlyViewedIcon"),pt=require("@redocly/theme/icons/ArrowLeftIcon/ArrowLeftIcon"),ht=e=>e&&e.__esModule?e:{default:e},l=ht(X);function xt({placeholder:e="Ask anything...",className:t,disabled:n,isStreaming:r=!1,onStop:o,modelSelector:s,value:a,onValueChange:c,onSubmit:d,textareaRef:u}){const p=a.trim(),v=!n&&p.length>0&&!r,g=!n&&p.length>0,w=A=>{c(A.target.value)},m=()=>{!p||n||r||d()},b=()=>{!r||!o||o()},C=A=>{A.key==="Enter"&&!A.shiftKey&&!A.nativeEvent.isComposing&&(A.preventDefault(),r&&o?b():m())};return i.jsxs(gt,{className:t,$isActive:g,children:[i.jsx(vt,{ref:u,rows:1,maxLength:Ge.AI_SEARCH_MAX_MESSAGE_LENGTH,placeholder:e,value:a,disabled:n,spellCheck:!1,onChange:w,onKeyDown:C}),i.jsxs(mt,{children:[s,r&&o?i.jsx(wt,{type:"button",size:"small","aria-label":"Stop generating",icon:i.jsx(We.StopIcon,{color:"var(--icon-color-on-color)"}),onClick:b}):i.jsx(yt,{type:"button",size:"small","aria-label":"Send message",icon:i.jsx(Ue.SendIcon,{color:"var(--icon-color-on-color)"}),onClick:m,disabled:!v})]})]})}const gt=l.default.div`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),h=require("react"),X=require("styled-components"),f=require("./replay-index-DYtXcqDk.js"),x=require("./replay-useAiChatQueries-Bypgnkwa.js"),Ge=require("@redocly/theme/core/constants/search"),E=require("@redocly/theme/components/Button/Button"),Ue=require("@redocly/theme/icons/SendIcon/SendIcon"),We=require("@redocly/theme/icons/StopIcon/StopIcon"),M=require("./replay-db-BQXljNM0.js"),Ye=require("@redocly/theme/icons/CheckboxIcon/CheckboxIcon"),Ke=require("@redocly/theme/icons/CheckmarkFilledIcon/CheckmarkFilledIcon"),Je=require("@redocly/theme/icons/CloseFilledIcon/CloseFilledIcon"),Xe=require("@redocly/theme/icons/AddIcon/AddIcon"),Ze=require("@redocly/theme/icons/SubtractIcon/SubtractIcon"),K=require("@redocly/theme/core/utils"),Qe=require("@redocly/theme/icons/ChevronDownIcon/ChevronDownIcon"),et=require("@redocly/theme/icons/ChevronRightIcon/ChevronRightIcon"),tt=require("@redocly/theme/components/Dropdown/Dropdown"),nt=require("@redocly/theme/components/Dropdown/DropdownMenu"),Ie=require("@redocly/theme/components/Dropdown/DropdownMenuItem"),rt=require("@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon"),ot=require("@redocly/theme/icons/SettingsCogIcon/SettingsCogIcon"),it=require("@redocly/theme/icons/ChatGptIcon/ChatGptIcon"),st=require("@redocly/theme/icons/GeminiIcon/GeminiIcon"),at=require("@redocly/theme/icons/ClaudeIcon/ClaudeIcon"),B=require("@redocly/theme/components/Tooltip/Tooltip"),ae=require("./replay-SemanticSearchService-DTc0oxN4.js");require("@tanstack/react-query");const G=require("@redocly/theme/components/Typography/Typography"),lt=require("@redocly/theme/icons/TrashCanIcon/TrashCanIcon"),ct=require("@redocly/theme/icons/AiStarsGradientIcon/AiStarsGradientIcon"),dt=require("@redocly/theme/icons/CloseIcon/CloseIcon"),ut=require("@redocly/theme/icons/NewChatIcon/NewChatIcon"),ft=require("@redocly/theme/icons/RecentlyViewedIcon/RecentlyViewedIcon"),pt=require("@redocly/theme/icons/ArrowLeftIcon/ArrowLeftIcon"),ht=e=>e&&e.__esModule?e:{default:e},l=ht(X);function xt({placeholder:e="Ask anything...",className:t,disabled:n,isStreaming:r=!1,onStop:o,modelSelector:s,value:a,onValueChange:c,onSubmit:d,textareaRef:u}){const p=a.trim(),v=!n&&p.length>0&&!r,g=!n&&p.length>0,w=A=>{c(A.target.value)},m=()=>{!p||n||r||d()},b=()=>{!r||!o||o()},C=A=>{A.key==="Enter"&&!A.shiftKey&&!A.nativeEvent.isComposing&&(A.preventDefault(),r&&o?b():m())};return i.jsxs(gt,{className:t,$isActive:g,children:[i.jsx(vt,{ref:u,rows:1,maxLength:Ge.AI_SEARCH_MAX_MESSAGE_LENGTH,placeholder:e,value:a,disabled:n,spellCheck:!1,onChange:w,onKeyDown:C}),i.jsxs(mt,{children:[s,r&&o?i.jsx(wt,{type:"button",size:"small","aria-label":"Stop generating",icon:i.jsx(We.StopIcon,{color:"var(--icon-color-on-color)"}),onClick:b}):i.jsx(yt,{type:"button",size:"small","aria-label":"Send message",icon:i.jsx(Ue.SendIcon,{color:"var(--icon-color-on-color)"}),onClick:m,disabled:!v})]})]})}const gt=l.default.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: var(--spacing-xs);
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./replay-index-DYtXcqDk.js"),m=require("./replay-SemanticSearchService-DTc0oxN4.js");var v;(function(l){l.WINDOW_RESIZED="tauri://resize",l.WINDOW_MOVED="tauri://move",l.WINDOW_CLOSE_REQUESTED="tauri://close-requested",l.WINDOW_DESTROYED="tauri://destroyed",l.WINDOW_FOCUS="tauri://focus",l.WINDOW_BLUR="tauri://blur",l.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",l.WINDOW_THEME_CHANGED="tauri://theme-changed",l.WINDOW_CREATED="tauri://window-created",l.WEBVIEW_CREATED="tauri://webview-created",l.DRAG_ENTER="tauri://drag-enter",l.DRAG_OVER="tauri://drag-over",l.DRAG_DROP="tauri://drag-drop",l.DRAG_LEAVE="tauri://drag-leave"})(v||(v={}));async function E(l,e){await d.invoke("plugin:event|unlisten",{event:l,eventId:e})}async function w(l,e,a){var t;const i=(t=void 0)!==null&&t!==void 0?t:{kind:"Any"};return d.invoke("plugin:event|listen",{event:l,target:i,handler:d.transformCallback(e)}).then(s=>async()=>E(l,s))}const p="replay-environments.yaml";class F{constructor(e,a,t,i,s,o){this.storage=e,this.projectDir=a,this.aiEnabled=t,this.setEnvironments=i,this.apis=s,this.collections=o}storage;projectDir;aiEnabled;setEnvironments;apis;collections;watchPath=null;unlistenEvent=null;get tauriStorage(){return this.storage}indexApis(e){!this.aiEnabled||e.length===0||m.getSemanticSearchService().indexApis(e).catch(a=>console.error("Semantic index (apis):",a))}indexCollections(e){!this.aiEnabled||e.length===0||m.getSemanticSearchService().indexCollections(e).catch(a=>console.error("Semantic index (collections):",a))}removeApis(e){if(!this.aiEnabled||e.length===0)return;const a=m.getSemanticSearchService();Promise.all(e.map(t=>a.removeApi(t))).catch(t=>console.error("Semantic remove (apis):",t))}removeCollections(e){if(!this.aiEnabled||e.length===0)return;const a=m.getSemanticSearchService();Promise.all(e.map(t=>a.removeCollection(t))).catch(t=>console.error("Semantic remove (collections):",t))}async start(){if(this.watchPath){console.warn("Watcher already started for:",this.watchPath);return}try{this.unlistenEvent=await w("fs-watch-event",async e=>{const a=e.payload;try{await this.handleEvent(a)}catch(t){console.error("Error handling file change:",t)}}),await d.invoke("fs_watch",{path:this.projectDir,options:{recursive:!0,delayMs:500}}),this.watchPath=this.projectDir}catch(e){throw console.error("Failed to start file watcher:",e),this.unlistenEvent&&(this.unlistenEvent(),this.unlistenEvent=null),e}}async stop(){if(this.watchPath)try{await d.invoke("fs_unwatch",{path:this.watchPath})}catch(e){console.error("Error stopping file watcher:",e)}finally{this.unlistenEvent&&(this.unlistenEvent(),this.unlistenEvent=null),this.watchPath=null}}async handleEvent(e){const{changeType:a,paths:t,pathTypes:i,type:s}=e;if(await this.isProjectFolderRemoved(t,a)){await this.handleProjectFolderRemoval();return}const o=this.filterSpecFiles(t,i);if(o.paths.length===0)return;const n=await this.toFileEntries(o.paths,o.pathTypes);switch(a){case"changed":(s.includes("Data")||s.includes("Name"))&&await this.handleModify(n);break;case"added":await this.handleCreate(n);break;case"deleted":await this.handleDelete(n);break;case"renamed":await this.handleRename(n);break;default:console.log("Unhandled change type:",a)}}filterSpecFiles(e,a){const t=[],i=[];for(let s=0;s<e.length;s++){const o=e[s],n=o.split(".").pop()?.toLowerCase();n&&["yaml","yml","json"].includes(n)&&(t.push(o),i.push(a[s]||"unknown"))}return{paths:t,pathTypes:i}}async toFileEntries(e,a){return Promise.all(e.map(async(t,i)=>({relative_path:await d.PathUtils.relative(this.projectDir,t),absolute_path:t,type:a[i]||"unknown"})))}hasEnvironmentsFileChange(e){return!this.storage.isWatchExcluded(p)&&e.some(a=>a.relative_path===p)}withoutEnvironmentsFile(e){return e.filter(a=>a.relative_path!==p)}consolidateFileEntries(e){const a=[],t=new Set;for(const i of e)t.has(i.relative_path)||(t.add(i.relative_path),this.storage.isWatchExcluded(i.relative_path)||a.push(i));return a}async handleModify(e){const a=this.hasEnvironmentsFileChange(e),t=this.withoutEnvironmentsFile(e),{newApiFiles:i,existingApiFiles:s}=this.categorizeApisFromFiles(t),{newCollectionFiles:o,existingCollectionFiles:n}=this.categorizeCollectionsFromFiles(t),r=await this.findApisToReload(e),c=await this.findCollectionsToReload(e),u=[...i,...o];u.length>0&&await this.handleCreate(u),a&&await this.reloadEnvironments();const g=this.consolidateFileEntries([...s,...r]),f=this.consolidateFileEntries([...n,...c]);await this.reloadApis(g),await this.reloadCollections(f)}async handleCreate(e){this.hasEnvironmentsFileChange(e)&&await this.reloadEnvironments();const a=this.withoutEnvironmentsFile(e),t=a.filter(c=>c.type==="api"),i=a.filter(c=>c.type==="collection"),{newApiFiles:s,existingApiFiles:o}=this.categorizeApisFromFiles(t),{newCollectionFiles:n,existingCollectionFiles:r}=this.categorizeCollectionsFromFiles(i);if(s.length>0||n.length>0){s.forEach(h=>this.storage.addPersistExcludedId(h.relative_path)),n.forEach(h=>this.storage.addPersistExcludedId(h.relative_path));const c=s.length>0?await this.tauriStorage.loadAndParseApis(s,void 0,!0):[],u=n.length>0?await this.tauriStorage.loadAndParseCollections(n,void 0):[],g=c.filter(h=>h!==null),f=u.filter(h=>h!==null);this.apis.set([...this.apis.get(),...g]),this.collections.set([...this.collections.get(),...f]),this.indexApis(g),this.indexCollections(f),setTimeout(()=>{s.forEach(h=>this.storage.removePersistExcludedId(h.relative_path)),n.forEach(h=>this.storage.removePersistExcludedId(h.relative_path))},500)}o.length>0&&await this.reloadApis(o),r.length>0&&await this.reloadCollections(r)}categorizeApisFromFiles(e){const a=new Set,t=[],i=[];for(const s of e){if(a.has(s.relative_path))continue;a.add(s.relative_path),this.apis.get().some(n=>n.id===s.relative_path)?i.push(s):s.type==="api"&&t.push(s)}return{newApiFiles:t,existingApiFiles:i}}categorizeCollectionsFromFiles(e){const a=new Set,t=[],i=[];for(const s of e){if(a.has(s.relative_path))continue;a.add(s.relative_path),this.collections.get().some(n=>n.id===s.relative_path)?i.push(s):s.type==="collection"&&t.push(s)}return{newCollectionFiles:t,existingCollectionFiles:i}}async handleDelete(e){this.hasEnvironmentsFileChange(e)&&await this.reloadEnvironments();const a=[],t=[];for(const i of this.withoutEnvironmentsFile(e)){this.storage.addPersistExcludedId(i.relative_path);const s=this.apis.get();s.some(r=>r.id===i.relative_path)&&(this.apis.set(s.filter(r=>r.id!==i.relative_path)),this.tauriStorage.deleteApiFromCache(i.relative_path),a.push(i.relative_path));const o=this.collections.get(),n=o.findIndex(r=>r.id===i.relative_path);n>=0&&(this.collections.set(o.filter((r,c)=>c!==n)),t.push(i.relative_path)),setTimeout(()=>{this.storage.removePersistExcludedId(i.relative_path)},500)}this.removeApis(a),this.removeCollections(t)}async handleRename(e){if(e.length>=2){const[a,t]=e;await this.handleDelete([a]),await this.handleCreate([t])}else await this.handleCreate(e)}async isProjectFolderRemoved(e,a){if(e.length===0)return!1;if(a==="deleted"||a==="renamed"){for(const i of e)if(i===this.projectDir)return!0}return e.filter(i=>!i.startsWith(this.projectDir+"/")&&i!==this.projectDir).length>0&&a==="renamed"}async handleProjectFolderRemoval(){const e=this.apis.get(),a=e.map(s=>s.id);e.forEach(s=>{this.storage.addPersistExcludedId(s.id),this.tauriStorage.deleteApiFromCache(s.id)}),this.apis.set([]);const t=this.collections.get(),i=t.map(s=>s.id);t.forEach(s=>{this.storage.addPersistExcludedId(s.id)}),this.collections.set([]),setTimeout(()=>{e.forEach(s=>this.storage.removePersistExcludedId(s.id)),t.forEach(s=>this.storage.removePersistExcludedId(s.id))},500),this.removeApis(a),this.removeCollections(i),await this.stop()}async findApisToReload(e){const a=[];return await Promise.all(this.apis.get().map(async t=>{const i=t.fileDependencies??new Set,s=t.id,o=e.find(n=>i.has(n.absolute_path));if(!this.storage.isWatchExcluded(s)&&o){const n=await d.PathUtils.join(this.projectDir,s);a.push({relative_path:s,absolute_path:n,type:"api"})}})),a}async findCollectionsToReload(e){const a=[];return await Promise.all(this.collections.get().map(async t=>{const i=t.fileDependencies??new Set,s=t.id,o=e.find(n=>i.has(n.absolute_path));if(!this.storage.isWatchExcluded(s)&&o){const n=await d.PathUtils.join(this.projectDir,s);a.push({relative_path:s,absolute_path:n,type:"collection"})}})),a}async reloadEnvironments(){const e=await this.tauriStorage.readEnviroments();this.storage.addPersistExcludedId(p),this.setEnvironments(e.length>0?e:d.cloneObject(d.DEFAULT_ENVIRONMENTS)),this.storage.publishEnvironmentsConfigError(),setTimeout(()=>{this.storage.removePersistExcludedId(p)},500)}async reloadApis(e){if(e.length===0)return;const a=await this.tauriStorage.loadAndParseApis(e,void 0,!0),t=[];await Promise.all(a.map(async(i,s)=>{if(!i){await this.handleDelete([e[s]]);return}const o=this.apis.get();o.some(n=>n.id===i.id)?(this.storage.addPersistExcludedId(i.id),this.apis.set(o.map(n=>n.id===i.id?i:n)),t.push(i),setTimeout(()=>this.storage.removePersistExcludedId(i.id),500)):console.warn("API not found in state after reload:",i.id)})),t.length>0&&this.indexApis(t)}async reloadCollections(e){if(e.length===0)return;const a=await this.tauriStorage.loadAndParseCollections(e,void 0),t=[];await Promise.all(a.map(async(i,s)=>{if(!i){await this.handleDelete([e[s]]);return}const o=this.collections.get(),n=o.findIndex(r=>r.id===i.id);n>=0?(this.storage.addPersistExcludedId(i.id),this.collections.set(o.map((r,c)=>c===n?i:r)),t.push(i),setTimeout(()=>this.storage.removePersistExcludedId(i.id),500)):console.warn("Collection not found in state after reload:",i.id)})),t.length>0&&this.indexCollections(t)}}exports.FileWatcher=F;
@@ -1,6 +1,5 @@
1
- import { i as m, t as w, P as E, c as F, D as C } from "./replay-index-B-Z3hRlH.js";
2
- import { g } from "./replay-SemanticSearchService-B_97hbQZ.js";
3
- import "react";
1
+ import { i as m, t as w, P as E, q as F, D as C } from "./replay-index-BCz452N6.js";
2
+ import { g } from "./replay-SemanticSearchService-BLF1oOOu.js";
4
3
  var v;
5
4
  (function(l) {
6
5
  l.WINDOW_RESIZED = "tauri://resize", l.WINDOW_MOVED = "tauri://move", l.WINDOW_CLOSE_REQUESTED = "tauri://close-requested", l.WINDOW_DESTROYED = "tauri://destroyed", l.WINDOW_FOCUS = "tauri://focus", l.WINDOW_BLUR = "tauri://blur", l.WINDOW_SCALE_FACTOR_CHANGED = "tauri://scale-change", l.WINDOW_THEME_CHANGED = "tauri://theme-changed", l.WINDOW_CREATED = "tauri://window-created", l.WEBVIEW_CREATED = "tauri://webview-created", l.DRAG_ENTER = "tauri://drag-enter", l.DRAG_OVER = "tauri://drag-over", l.DRAG_DROP = "tauri://drag-drop", l.DRAG_LEAVE = "tauri://drag-leave";
@@ -21,7 +20,7 @@ async function y(l, e, a) {
21
20
  }).then((s) => async () => _(l, s));
22
21
  }
23
22
  const d = "replay-environments.yaml";
24
- class D {
23
+ class P {
25
24
  constructor(e, a, t, i, s, o) {
26
25
  this.storage = e, this.projectDir = a, this.aiEnabled = t, this.setEnvironments = i, this.apis = s, this.collections = o;
27
26
  }
@@ -356,5 +355,5 @@ class D {
356
355
  }
357
356
  }
358
357
  export {
359
- D as FileWatcher
358
+ P as FileWatcher
360
359
  };
@@ -1,5 +1,5 @@
1
- import { h as i } from "./replay-history.schema-5ce6X0R1.js";
2
- import { s as n, e as r, d as a } from "./replay-indexes-CfsvVMi_.js";
1
+ import { h as i } from "./replay-history.schema-B0lLwmdG.js";
2
+ import { f as n, e as r, d as a } from "./replay-indexes-B3PJtgeh.js";
3
3
  function d(t) {
4
4
  return n`count(${n.raw("*")})`.mapWith(Number);
5
5
  }