PageSourceSearch

https://surf-demo.vercel.app/_next/static/chunks/472.d13482bbd546402e.js

js surf-demo.vercel.app collected 2026-10-03 07:51:07 UTC 7,805 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[472],{30654:(e,t,a)=>{a.d(t,{Fj:()=>i,GD:()=>c,fI:()=>l,gc:()=>n,h1:()=>s});let n={"1675f38e-8d2c-44b6-957d-3d2ef5625b6c":{userMessageContent:"I've heard WLFI is set to launch soon, and the \"non-transferable for 12 months\" clause has reportedly been removed from its service terms—can you confirm if that's true?",mockFilePath:"/mock/1.json",group:"research"},"2e72f38e-5d2c-44b6-957d-3d2ef5625b6c":{userMessageContent:"Estimate how much worth of Abstract token airdrop I can receive at TGE if I get 5,000 XP in the Abstract portal every week.",mockFilePath:"/mock/2.json",group:"research"},"3f75f38e-8d2c-44b6-957d-3d2ef5625b6c":{userMessageContent:"Fetch the daily swap volume (USD) for the ETH/USDC 0.05 % pool on Uniswap V3 on Ethereum mainnet for UTC 2025-01-02.",mockFilePath:"/mock/3.json",group:"research"},"436b27f1-ac03-46b2-8ad4-2b9ee8e7f0fb":{userMessageContent:'Complete "Explore CYBER and Bridge to Base" quest on Layer3',mockFilePath:"/mock/4.json",group:"execution"},"512b17ad-8d2c-44b6-957d-3d2ef5625b6c":{userMessageContent:"Check Spark airdrop for wearehiring.eth",mockFilePath:"/mock/5.json",group:"execution"},"6f75f38e-8d2c-44b6-957d-3d2ef5625b6c":{userMessageContent:"Deposit 0.1 USDC and matching USDT to the USDC/USDT pool on Aerodrome (0.01 % fee, \xb10.03 % price range)",mockFilePath:"/mock/6.json",group:"execution"}},o=Object.keys(n),s=e=>o.filter(t=>n[t].group===e),r={"436b27f1-ac03-46b2-8ad4-2b9ee8e7f0fb":"https://metadata.ask.surf/videos/layer3.mov","512b17ad-8d2c-44b6-957d-3d2ef5625b6c":"https://metadata.ask.surf/videos/spark.mov","6f75f38e-8d2c-44b6-957d-3d2ef5625b6c":"https://metadata.ask.surf/videos/liquidity.mov"},c=e=>o.includes(e),i=e=>n[e],l=e=>{var t;return null!=(t=r[e])?t:null}},40472:(e,t,a)=>{a.r(t),a.d(t,{WebSocketProvider:()=>k,useWebSocketContext:()=>y});var n=a(24312),o=a(60308),s=a(66274),r=a(91997),c=a(9692),i=a(14499);async function*l(e){return e.endsWith(".json")?yield*u(e):yield*d(e)}async function*d(e){for(let t of(await p(e)).split("\n\n")){let[e,a]=t.split("\n"),n=null==e?void 0:e.split("event: ")[1],o=null==a?void 0:a.split("data: ")[1];try{let e={event_type:n,message_id:"1",thread_id:"1",agent_name:"1",data:JSON.parse(o)};yield e,"message_chunk"===e.event_type&&(e.data.finish_reason||await (0,i.yy)(5)),"tool_calls"===e.event_type&&await (0,i.yy)(2e3)}catch(e){console.error(e)}}}async function*u(e){let t=await p(e),a=[];try{a=JSON.parse(t)}catch(e){console.error("Failed to parse mock JSON stream:",e);return}for(let e of a){if("message_chunk"===e.event_type&&("Successfully completed <Explore CYBER and Bridge to Base> quest on Layer3"==e.data.content&&await (0,i.yy)(4e4),"Successfully determined Spark airdrop eligibility for ENS domain wearehiring.eth. wearehiring.eth is not eligible for the Spark (SPK) airdrop."==e.data.content&&await (0,i.yy)(24e3),"Successfully deposited 0.1 USDC and matching USDT to the USDC/USDT pool on Aerodrome (0.01% fee, \xb10.03% price range)."==e.data.content&&await (0,i.yy)(3e4)),yield e,"message_chunk"===e.event_type&&await (0,i.yy)(5),"reasoning"===e.event_type)switch(e.data.phase){case"start":break;case"chunk":await (0,i.yy)(5);break;case"end":await (0,i.yy)(500)}if("tool_calls"===e.event_type)switch(e.data.phase){case"start":case"chunk":break;case"end":await (0,i.yy)(500)}if("custom"===e.event_type){let t=e.data;"SANDBOX_UPDATE"===t.event_data.type?await (0,i.yy)(500):"REQUEST_HUMAN_APPROVAL"===t.event_data.type&&await (0,i.yy)(2e3)}}}async function p(e){let t=await fetch(e);if(!t.ok)throw Error("Failed to fetch replay: ".concat(t.statusText));return t.text()}var h=a(25407),f=a(30654);let g=a(78362).env.NEXT_PUBLIC_CHAT_WS_URL,m=(0,o.createContext)(null);function k(e){let{children:t,sessionId:a}=e,i=(0,r.Pj)(),d=(0,o.useCallback)(e=>{let t,{message_id:a}=e;a&&(t=i.get(c.MZ).get(a));let n=function(e,t){var a,n,o,s,r,c;let i;switch(i=e?{...e}:{messageId:t.message_id,threadId:t.thread_id,role:"user"===t.agent_name?"user":"assistant",agentName:t.agent_name,content:"",reasoning:"",toolCalls:[],steps:[],isEnd:!1,thinkingTime:void 0},t.event_type){case"message_chunk":{let e=t.data;"reporter"===t.agent_name&&e.content&&(i.content+=e.content),"coordinator"===t.agent_name&&e.content&&(i.coordinatorContent=e.content),void 0===i.thinkingTime&&"number"==typeof e.thinking_time&&(i.thinkingTime=e.thinking_time),"quest_executor"===t.agent_name&&e.content&&(i.executorContent=e.content);break}case"reasoning":{let e=t.data,n=i.steps.find(t=>"reasoning"===t.type&&t.id===e.reasoning_id);n||(n={type:"reasoning",id:e.reasoning_id,text:""},i.steps.push(n)),n.text+=e.text_chunk,i.reasoning=(null!=(a=i.reasoning)?a:"")+e.text_chunk;break}case"tool_calls":{let e=t.data,a=null==(n=i.toolCalls)?void 0:n.find(t=>
1t.id===e.tool_call_id);if(a||(a={type:"tool_call",id:e.tool_call_id,name:e.tool_name,args:e.args,phase:e.phase},i.toolCalls.push(a),i.steps.push(a)),a&&(a.phase=e.phase,a.args=e.args,e.content&&e.content.trim().length>0))try{a.result=JSON.parse(e.content)}catch(t){a.result=e.content}break}case"interrupt":{let e=null!=(s=null==(o=t.data)?void 0:o.content)?s:"";i.content+="\n[Interruption]: ".concat(e);break}case"error":{let e=null!=(c=null==(r=t.data)?void 0:r.content)?c:"Unknown error";i.content+="\n[Error]: ".concat(e),i.finishReason="error";break}case"end":i.finishReason="stop",i.isEnd=!0;break;case"custom":{let e=t.data.event_data;switch(null==e?void 0:e.type){case"REQUEST_HUMAN_APPROVAL":{let t,a=e.approval_id;try{t=JSON.parse(e.task)}catch(e){t={primary_goal:"",execution_steps:[]}}let n=i.steps.find(e=>"approval"===e.type&&e.id===a);n?n.task=t:(n={type:"approval",id:a,task:t},i.steps.push(n));break}case"SANDBOX_UPDATE":{let{sandbox_id:t,sandbox_status:a}=e,n=i.steps.find(e=>"sandbox"===e.type&&e.id===t);n?n.status=a:(n={type:"sandbox",id:t,status:a},i.steps.push(n))}}}}return i}(t,e);t?i.set(c.oK,n):i.set(c.ZO,n),"end"===e.event_type&&i.set(c.we,!1)},[i]),[u,p]=(0,o.useState)(!1),k=(0,r.md)(h.Y_),y=(null==k?void 0:k.token)?"?token=".concat(encodeURIComponent(k.token)):"",_="".concat(g,"/v1/chat/sessions/").concat(a,"/ws").concat(y),{sendJsonMessage:b,readyState:v,getWebSocket:w}=(0,s.Ay)(_,{onOpen:()=>{console.log("Global WebSocket connected")},onClose:()=>{console.log("Global WebSocket disconnected"),i.set(c.we,!1),p(!1)},onError:e=>{console.error("Global WebSocket error:",e),i.set(c.we,!1)},onMessage:e=>{try{let t=JSON.parse(e.data);d(t),window.__wsMessages=window.__wsMessages||[],window.__wsMessages.push(t)}catch(e){console.error("Failed to parse WebSocket message:",e)}},shouldReconnect:()=>u,reconnectAttempts:5,reconnectInterval:e=>Math.min(1e3*Math.pow(2,e),1e4)},u),C=(0,o.useCallback)(()=>{u||p(!0)},[u]),S=(0,o.useCallback)(()=>{let e=w();e&&e.readyState===s.vj.OPEN&&e.close(),p(!1)},[w]),E=(0,o.useCallback)((e,t)=>{u||p(!0),b({messages:[{role:"user",content:e}],open_quest_executor:t}),i.set(c.we,!0)},[b,u,i]),N=(0,o.useCallback)(e=>{u||p(!0),b(e)},[b,u]),x={[s.vj.CONNECTING]:"Connecting",[s.vj.OPEN]:"Open",[s.vj.CLOSING]:"Closing",[s.vj.CLOSED]:"Closed",[s.vj.UNINSTANTIATED]:"Uninstantiated"}[v],U=(0,f.GD)(a);(0,o.useEffect)(()=>{if(!U)return;let e=!1;return(async()=>{let t=(0,f.Fj)(a);if(!t)return;let n={messageId:"test",threadId:"123",role:"user",content:t.userMessageContent,steps:[],isEnd:!1,thinkingTime:void 0};for await(let a of(i.set(c.ZO,n),i.set(c.we,!0),l(t.mockFilePath))){if(e)break;d(a)}})(),()=>{e=!0}},[U,a]);let P={sendChatMessage:E,sendApprovalResponse:N,connect:C,disconnect:S,isConnected:v===s.vj.OPEN,connectionState:x,readyState:v};return(0,n.jsx)(m.Provider,{value:P,children:t})}function y(){let e=(0,o.useContext)(m);if(!e)throw Error("useWebSocketContext must be used within a WebSocketProvider");return e}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.