@hugex/ai 3.4.1 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.js CHANGED
@@ -1 +1 @@
1
- import{a as Qt,b as Xt,c as zt,d as Bt}from"./chunk-J67BCWE3.js";import{$ as vt,A as Je,Aa as Gt,B as Ge,Ba as $t,C as $e,Ca as Lt,D as Le,Da as Yt,E as Ye,Ea as kt,F as ke,Fa as Kt,G as Ke,H as Qe,I as Xe,J as ze,K as Be,L as We,M as Ze,N as et,O as tt,P as nt,Q as st,R as ot,S as rt,T as at,U as it,V as gt,W as lt,X as pt,Y as ct,Z as ut,_ as dt,a as u,aa as yt,b as Q,ba as mt,c as T,ca as St,d as X,da as At,e as z,ea as Rt,f as B,fa as Mt,g as W,ga as Et,h as Z,ha as Tt,i as ee,ia as It,j as te,ja as Ct,k as ne,ka as ht,l as se,la as wt,m as oe,ma as xt,n as re,na as _t,o as ae,oa as bt,p as ie,pa as Nt,q as ge,qa as Ot,r as le,ra as qt,s as pe,sa as Vt,t as ce,ta as Ft,u as ue,ua as Dt,v as Se,va as Ht,w as fe,wa as jt,x as Ae,xa as Ut,y as Ue,ya as Pt,z as Pe,za as Jt}from"./chunk-YXG3ZEUP.js";import{A as He,B as je,a as $,b as L,c as Y,d as k,e as K,f as de,g as ve,h as ye,i as me,j as Re,k as Me,l as Ee,m as Te,n as Ie,o as Ce,p as he,q as we,r as xe,s as _e,t as be,u as Ne,v as Oe,w as qe,x as Ve,y as Fe,z as De}from"./chunk-KKJW6HJA.js";import{a as ft}from"./chunk-HJPR76HF.js";import{a as G}from"./chunk-U56YWPSI.js";import"./chunk-3TXHFKDN.js";import{useAgent as U}from"agents/react";import{useCallback as d,useEffect as P,useMemo as J,useRef as m}from"react";import{create as F}from"zustand";import{devtools as D}from"zustand/middleware";var H={messages:[],events:[],eventsVisible:!1,status:"connecting",typingMessage:null,reasoningMessage:null,reasoningMessages:[],isReasoning:!1,stepInfo:null,approvals:[],error:null,flowConfig:null,composioAuth:null};function C(n){return F()(D((t,y)=>({...H,initHistory:e=>t({messages:e}),addEvent:e=>t(o=>({events:[...o.events,{...e,ts:Date.now()}]})),clearEvents:()=>t({events:[]}),setMessages:e=>{t({messages:e})},addMessage:e=>{t(o=>({messages:[...o.messages,e]}))},setTyping:e=>t({typingMessage:e}),appendTyping:(e,o)=>{let r=y().typingMessage;r&&r.id===e?t({typingMessage:{id:e,text:r.text+o}}):t({typingMessage:{id:e,text:o}})},clearTyping:()=>t({typingMessage:null}),setReasoning:e=>t({reasoningMessage:e}),appendReasoning:(e,o)=>{let r=y().reasoningMessage;r&&r.id===e?t({reasoningMessage:{id:e,text:r.text+o}}):t({reasoningMessage:{id:e,text:o}})},commitReasoning:e=>{t(o=>{var r;return(r=o.reasoningMessage)!=null&&r.text?{reasoningMessages:[...o.reasoningMessages,{...o.reasoningMessage,ts:e??Date.now()}],reasoningMessage:null,isReasoning:!1}:{reasoningMessage:null,isReasoning:!1}})},clearReasoning:()=>t({reasoningMessage:null,isReasoning:!1}),setReasoningMessages:e=>t({reasoningMessages:e}),setReasoningActive:e=>t({isReasoning:e}),setStep:e=>t({stepInfo:e}),clearStep:()=>t({stepInfo:null}),setStatus:e=>t({status:e}),toggleEvents:()=>t(e=>({eventsVisible:!e.eventsVisible})),clearHistory:()=>t({messages:[],typingMessage:null,reasoningMessage:null,reasoningMessages:[],isReasoning:!1,stepInfo:null}),addApprovalRequest:e=>{let o={id:`approval-${Date.now()}-${Math.random()}`,toolCallId:e.toolCallId,toolName:e.toolName,args:e.args??{},description:e.description,ts:Date.now(),status:"pending"};t(r=>({approvals:[...r.approvals,o]}))},updateApprovalStatus:({toolCallId:e,status:o})=>{t(r=>({approvals:r.approvals.map(v=>v.toolCallId===e?{...v,status:o}:v)}))},removeApproval:e=>{t(o=>({approvals:o.approvals.filter(r=>r.toolCallId!==e)}))},setError:e=>t({error:e}),setFlowConfig:e=>t({flowConfig:e}),setComposioAuth:e=>t({composioAuth:e}),clearComposioAuth:()=>t({composioAuth:null})}),{name:n,enabled:!0}))}var j=C("agent-store"),I=new Map;function h(n){if(!n)return j;let t=I.get(n);return t||(t=C(`agent-store:${n}`),I.set(n,t)),t}function an(n){let t=J(()=>h(n==null?void 0:n.storeKey),[n==null?void 0:n.storeKey]),y=t(s=>s.typingMessage),e=m(null),o=m(null),r=m(null),v=m(0),S=m(null),f=()=>(v.current=Math.max(Date.now(),v.current+1),v.current);P(()=>{e.current=y},[y]);let A=d(s=>{var g;let i=s.trim().slice(0,T);!i||typeof((g=S.current)==null?void 0:g.send)!="function"||S.current.send(u.USER_IDENTITY+":"+i)},[]),l=U({host:n==null?void 0:n.host,basePath:(n==null?void 0:n.basePath)??"/api/agents/base",agent:n==null?void 0:n.agent,name:n==null?void 0:n.name,query:n==null?void 0:n.query,protocol:n==null?void 0:n.protocol,onMessage:s=>{if(typeof s.data!="string")return;let[i,g]=s.data.split("::");if(!i||!g)return;let a=t.getState(),R={[u.SERVER_HISTORY]:p=>{let c=JSON.parse(p);a.setMessages(c.messages),a.setReasoningMessages([])},[u.SERVER_EVENT]:p=>{var E;let c=JSON.parse(p);if((c==null?void 0:c.type)==="info:composio:auth_required"&&((E=c==null?void 0:c.content)!=null&&E.redirectUrl)){let M=c.content;a.setComposioAuth({toolkit:M.toolkit,redirectUrl:M.redirectUrl,toolRowId:M.toolRowId})}a.addEvent({type:"server",...c})},[u.SERVER_ERROR]:p=>{a.setError(p),a.addEvent({type:"error",content:p})},[u.SERVER_TEXT_STREAM]:p=>{o.current?a.appendTyping(o.current,p):(o.current=String(Date.now()),a.setTyping({id:o.current,text:p}))},[u.SERVER_TEXT_STREAM_COMPLETE]:p=>{if(a.setReasoningActive(!1),o.current&&a.typingMessage){let c=a.typingMessage.text;a.addMessage({role:"assistant",type:"text",content:c,id:o.current,ts:f()}),a.clearTyping(),o.current=null}},[u.SERVER_REASONING_STREAM]:p=>{a.setReasoningActive(!0),r.current?a.appendReasoning(r.current,p):(r.current=String(Date.now()),a.setReasoning({id:r.current,text:p}))},[u.SERVER_REASONING_STREAM_COMPLETE]:()=>{a.commitReasoning(f()),r.current=null},[u.SERVER_CONFIG]:p=>{a.setFlowConfig(JSON.parse(p))}};R[i]&&R[i](g)},onOpen:()=>{let s=t.getState();s.setStatus("connected"),s.clearTyping(),o.current=null,s.clearReasoning(),r.current=null,s.clearStep(),s.addEvent({type:"connection",content:"Connected to Agent Server"}),n!=null&&n.user&&A(n.user)},onClose:()=>{let s=t.getState();s.setStatus("disconnected"),s.setFlowConfig(null),s.addEvent({type:"connection",content:"Connection closed"})}});S.current=l;let w=d((s,i,g)=>{let a=s.trim();if(!a&&(!i||i.length===0)&&(!g||g.length===0))return;let p=((i==null?void 0:i.length)??0)>0||((g==null?void 0:g.length)??0)>0?JSON.stringify({text:a,images:i,documents:g}):a;l.send(u.USER_MESSAGE+":"+p);let c=t.getState();r.current=null,c.clearReasoning(),c.addMessage({id:String(Date.now())+Math.random(),role:"user",type:"text",content:a,images:i,ts:f()})},[l]),x=d(()=>{t.getState().clearHistory(),l.send(u.USER_CLEAR_HISTORY+":1")},[l]),_=d((s,i)=>{let g=s.trim();g&&l.send(u.USER_AUTH+":"+JSON.stringify({name:g,value:i}))},[l]),b=d(s=>{A(s)},[A]),N=d(()=>t.getState().toggleEvents(),[]),O=d(()=>t.getState().clearEvents(),[]),q=d(s=>{let i=t.getState();i.updateApprovalStatus({toolCallId:s,status:"approved"});let g=JSON.stringify({type:"tool_approval",toolCallId:s,approved:!0});typeof(l==null?void 0:l.send)=="function"&&l.send(g),i.addEvent({type:"approval",content:`Approved tool call ${s}`,ts:Date.now()})},[l]),V=d(s=>{let i=t.getState();i.updateApprovalStatus({toolCallId:s,status:"rejected"});let g=JSON.stringify({type:"tool_approval",toolCallId:s,approved:!1});typeof(l==null?void 0:l.send)=="function"&&l.send(g),i.addEvent({type:"approval",content:`Rejected tool call ${s}`,ts:Date.now()})},[l]);return{connection:l,store:t,send:w,clearHistory:x,sendAuth:_,setIdentity:b,toggleEventsVisible:N,clearEvents:O,approve:q,reject:V}}export{W as CLASSIFIER_DEFAULTS,Z as CLASSIFIER_RESERVED_HANDLES,B as CLEF_MODELS,ie as CRAWL_DEFAULTS,ge as CRAWL_LIMITS,Je as DEFAULT_MEMORY_LENGTH,Ge as DEFAULT_MEMORY_MODEL,L as FLOW_INPUT_NAME_RE,xt as GENERATION_PARAM_KEYS,bt as GENERATION_PRESETS,at as ISSUE_SEVERITY,T as MAX_USER_IDENTITY_LENGTH,Ue as MEMORY_LENGTH_MD_LINES,Pe as MEMORY_LENGTH_TOKENS,Qt as MODEL_REGISTRY_SNAPSHOT,Se as NODE_CATALOG,$ as NodeType,de as OUT_VAR_NAME_RE,_t as PRESET_PARAM_KEYS,Gt as REASONING_EFFORT_LEVELS,zt as TENANT_ONLY_NODES,Rt as TOOL_REGISTRY_SNAPSHOT,_e as VariableResolutionError,te as WORKER_GRAPH_DEFS,ne as WORKER_GRAPH_SCHEMA,se as WORKER_OP_SCHEMA,St as WORKER_TEMPLATES,qt as applyPresetToOverrides,yt as applyWorkerOps,Mt as buildClefRequest,le as buildCrawlRequestBody,Kt as buildReasoningProviderOptions,Ee as buildScope,K as buildTriggerMessageText,dt as canonicalGraph,Ke as capMemoryContent,ht as classifierErrorResult,ee as classifierHandle,At as classifierIdFromLabel,pt as classifyIssues,Tt as clefTruncationWarning,ot as collectExternalRefs,nt as collectNodeRefs,pe as crawlRequestKey,fe as defaultNodeData,Nt as deriveParamSupport,mt as detectInlineCredentials,vt as diffGraphs,ct as edgeId,ft as enabledComposioSlugs,Et as estimateClefTokens,ke as estimateTokens,Oe as extractOutVarValues,De as extractTemplateReferences,et as extractUserKeypoints,Te as findScopedSourceNode,h as getAgentStore,Re as getAncestorNodeIds,ve as getDefaultOutVars,me as getEffectiveOutVars,Y as getFlowInputDefs,Xt as getModelEntry,Ie as getRefTail,Me as getUpstreamOutVars,Ce as isBinaryOutVar,he as isJsonContentType,Bt as isNodeTypeAllowedForTenant,Qe as isStartMemoryEnabled,lt as issueFingerprint,G as logc,We as looksLikeTranscript,Be as memoryGenerationMaxTokens,Ye as memoryMdLineLimit,Le as memoryTokenLimit,tt as mergeKeypointMemory,u as messageTypes,rt as newExternalRefs,ut as nextNodeId,Ft as normalizeEffectiveParams,k as normalizeFlowInputs,$t as normalizeReasoning,jt as openAiReasoningParamSupport,Ht as openAiStandardParamSupport,Ct as parseClefResponse,$e as parseMemoryLength,we as parsePayloadText,Fe as parseTemplateExpression,z as parseUserAuth,Q as parseUserMessage,re as parseWorkerGraph,ae as parseWorkerOps,Vt as pickNodeOverrides,xe as readFetchPayload,Lt as reasoningEffortLevels,Yt as reasoningExposable,Ve as resolveOutVarRef,Ne as resolveOutVarValue,Ot as resolvePreset,kt as resolveReasoningEffort,qe as resolveReference,je as resolveTemplate,st as rewriteNodeDataRefs,He as rewriteTemplateNodeRefs,It as runClef,ue as runCrawl,Ze as sanitizeMemoryDocument,X as sanitizeUserIdentity,oe as schemaErrors,wt as selectClefHistory,ce as shapeCrawlOutput,ze as startMemoryLength,Xe as startMemoryModel,Jt as stripUnsupportedFromNodeData,Dt as toStreamTextSettings,an as useAgent,j as useAgentStore,gt as validateAuthoring,Ae as validateClassifierData,it as validateFlowStructure,ye as validateOutVars,be as walkPath,Pt as workersAiParamSupport,Ut as xaiParamSupport};
1
+ import{a as Cn,b as hn,c as wn,d as xn,e as _n}from"./chunk-GHMAKIZO.js";import{$ as vt,$a as mn,A as Ee,Aa as Gt,B as Te,Ba as $t,C as Ie,Ca as Lt,D as Ce,Da as Yt,E as he,Ea as kt,F as we,Fa as Kt,G as Ke,Ga as Qt,H as Qe,Ha as Xt,I as Xe,Ia as zt,J as ze,Ja as Bt,K as Be,Ka as Wt,L as We,La as Zt,M as Ze,Ma as en,N as et,Na as tn,O as tt,Oa as nn,P as nt,Pa as sn,Q as st,Qa as on,R as ot,Ra as rn,S as rt,Sa as an,T as at,Ta as gn,U as it,Ua as ln,V as gt,Va as pn,W as lt,Wa as cn,X as pt,Xa as un,Y as ct,Ya as dn,Z as ut,Za as vn,_ as dt,_a as yn,a as u,aa as yt,ab as Sn,b as Q,ba as mt,bb as fn,c as T,ca as St,cb as An,d as X,da as ft,db as Rn,e as z,ea as At,eb as Mn,f as B,fa as Rt,fb as En,g as W,ga as Mt,gb as Tn,h as Z,ha as Et,hb as In,i as ee,ia as Tt,j as te,ja as It,k as ne,ka as Ct,l as se,la as wt,m as oe,ma as xt,n as re,na as _t,o as ae,oa as bt,p as ie,pa as Nt,q as ge,qa as Ot,r as le,ra as qt,s as pe,sa as Vt,t as ce,ta as Ft,u as ue,ua as Dt,v as Se,va as Ht,w as fe,wa as jt,x as Ae,xa as Ut,y as Re,ya as Pt,z as Me,za as Jt}from"./chunk-G73VSMK7.js";import{A as Ye,B as ke,a as $,b as L,c as Y,d as k,e as K,f as de,g as ve,h as ye,i as me,j as xe,k as _e,l as be,m as Ne,n as Oe,o as qe,p as Ve,q as Fe,r as De,s as He,t as je,u as Ue,v as Pe,w as Je,x as Ge,y as $e,z as Le}from"./chunk-LUS5CJY2.js";import{a as ht}from"./chunk-HJPR76HF.js";import{a as G}from"./chunk-U56YWPSI.js";import"./chunk-3TXHFKDN.js";import{useAgent as U}from"agents/react";import{useCallback as d,useEffect as P,useMemo as J,useRef as m}from"react";import{create as F}from"zustand";import{devtools as D}from"zustand/middleware";var H={messages:[],events:[],eventsVisible:!1,status:"connecting",typingMessage:null,reasoningMessage:null,reasoningMessages:[],isReasoning:!1,stepInfo:null,approvals:[],error:null,flowConfig:null,composioAuth:null};function C(n){return F()(D((t,y)=>({...H,initHistory:e=>t({messages:e}),addEvent:e=>t(o=>({events:[...o.events,{...e,ts:Date.now()}]})),clearEvents:()=>t({events:[]}),setMessages:e=>{t({messages:e})},addMessage:e=>{t(o=>({messages:[...o.messages,e]}))},setTyping:e=>t({typingMessage:e}),appendTyping:(e,o)=>{let r=y().typingMessage;r&&r.id===e?t({typingMessage:{id:e,text:r.text+o}}):t({typingMessage:{id:e,text:o}})},clearTyping:()=>t({typingMessage:null}),setReasoning:e=>t({reasoningMessage:e}),appendReasoning:(e,o)=>{let r=y().reasoningMessage;r&&r.id===e?t({reasoningMessage:{id:e,text:r.text+o}}):t({reasoningMessage:{id:e,text:o}})},commitReasoning:e=>{t(o=>{var r;return(r=o.reasoningMessage)!=null&&r.text?{reasoningMessages:[...o.reasoningMessages,{...o.reasoningMessage,ts:e??Date.now()}],reasoningMessage:null,isReasoning:!1}:{reasoningMessage:null,isReasoning:!1}})},clearReasoning:()=>t({reasoningMessage:null,isReasoning:!1}),setReasoningMessages:e=>t({reasoningMessages:e}),setReasoningActive:e=>t({isReasoning:e}),setStep:e=>t({stepInfo:e}),clearStep:()=>t({stepInfo:null}),setStatus:e=>t({status:e}),toggleEvents:()=>t(e=>({eventsVisible:!e.eventsVisible})),clearHistory:()=>t({messages:[],typingMessage:null,reasoningMessage:null,reasoningMessages:[],isReasoning:!1,stepInfo:null}),addApprovalRequest:e=>{let o={id:`approval-${Date.now()}-${Math.random()}`,toolCallId:e.toolCallId,toolName:e.toolName,args:e.args??{},description:e.description,ts:Date.now(),status:"pending"};t(r=>({approvals:[...r.approvals,o]}))},updateApprovalStatus:({toolCallId:e,status:o})=>{t(r=>({approvals:r.approvals.map(v=>v.toolCallId===e?{...v,status:o}:v)}))},removeApproval:e=>{t(o=>({approvals:o.approvals.filter(r=>r.toolCallId!==e)}))},setError:e=>t({error:e}),setFlowConfig:e=>t({flowConfig:e}),setComposioAuth:e=>t({composioAuth:e}),clearComposioAuth:()=>t({composioAuth:null})}),{name:n,enabled:!0}))}var j=C("agent-store"),I=new Map;function h(n){if(!n)return j;let t=I.get(n);return t||(t=C(`agent-store:${n}`),I.set(n,t)),t}function jn(n){let t=J(()=>h(n==null?void 0:n.storeKey),[n==null?void 0:n.storeKey]),y=t(s=>s.typingMessage),e=m(null),o=m(null),r=m(null),v=m(0),S=m(null),f=()=>(v.current=Math.max(Date.now(),v.current+1),v.current);P(()=>{e.current=y},[y]);let A=d(s=>{var g;let i=s.trim().slice(0,T);!i||typeof((g=S.current)==null?void 0:g.send)!="function"||S.current.send(u.USER_IDENTITY+":"+i)},[]),l=U({host:n==null?void 0:n.host,basePath:(n==null?void 0:n.basePath)??"/api/agents/base",agent:n==null?void 0:n.agent,name:n==null?void 0:n.name,query:n==null?void 0:n.query,protocol:n==null?void 0:n.protocol,onMessage:s=>{if(typeof s.data!="string")return;let[i,g]=s.data.split("::");if(!i||!g)return;let a=t.getState(),R={[u.SERVER_HISTORY]:p=>{let c=JSON.parse(p);a.setMessages(c.messages),a.setReasoningMessages([])},[u.SERVER_EVENT]:p=>{var E;let c=JSON.parse(p);if((c==null?void 0:c.type)==="info:composio:auth_required"&&((E=c==null?void 0:c.content)!=null&&E.redirectUrl)){let M=c.content;a.setComposioAuth({toolkit:M.toolkit,redirectUrl:M.redirectUrl,toolRowId:M.toolRowId})}a.addEvent({type:"server",...c})},[u.SERVER_ERROR]:p=>{a.setError(p),a.addEvent({type:"error",content:p})},[u.SERVER_TEXT_STREAM]:p=>{o.current?a.appendTyping(o.current,p):(o.current=String(Date.now()),a.setTyping({id:o.current,text:p}))},[u.SERVER_TEXT_STREAM_COMPLETE]:p=>{if(a.setReasoningActive(!1),o.current&&a.typingMessage){let c=a.typingMessage.text;a.addMessage({role:"assistant",type:"text",content:c,id:o.current,ts:f()}),a.clearTyping(),o.current=null}},[u.SERVER_REASONING_STREAM]:p=>{a.setReasoningActive(!0),r.current?a.appendReasoning(r.current,p):(r.current=String(Date.now()),a.setReasoning({id:r.current,text:p}))},[u.SERVER_REASONING_STREAM_COMPLETE]:()=>{a.commitReasoning(f()),r.current=null},[u.SERVER_CONFIG]:p=>{a.setFlowConfig(JSON.parse(p))}};R[i]&&R[i](g)},onOpen:()=>{let s=t.getState();s.setStatus("connected"),s.clearTyping(),o.current=null,s.clearReasoning(),r.current=null,s.clearStep(),s.addEvent({type:"connection",content:"Connected to Agent Server"}),n!=null&&n.user&&A(n.user)},onClose:()=>{let s=t.getState();s.setStatus("disconnected"),s.setFlowConfig(null),s.addEvent({type:"connection",content:"Connection closed"})}});S.current=l;let w=d((s,i,g)=>{let a=s.trim();if(!a&&(!i||i.length===0)&&(!g||g.length===0))return;let p=((i==null?void 0:i.length)??0)>0||((g==null?void 0:g.length)??0)>0?JSON.stringify({text:a,images:i,documents:g}):a;l.send(u.USER_MESSAGE+":"+p);let c=t.getState();r.current=null,c.clearReasoning(),c.addMessage({id:String(Date.now())+Math.random(),role:"user",type:"text",content:a,images:i,ts:f()})},[l]),x=d(()=>{t.getState().clearHistory(),l.send(u.USER_CLEAR_HISTORY+":1")},[l]),_=d((s,i)=>{let g=s.trim();g&&l.send(u.USER_AUTH+":"+JSON.stringify({name:g,value:i}))},[l]),b=d(s=>{A(s)},[A]),N=d(()=>t.getState().toggleEvents(),[]),O=d(()=>t.getState().clearEvents(),[]),q=d(s=>{let i=t.getState();i.updateApprovalStatus({toolCallId:s,status:"approved"});let g=JSON.stringify({type:"tool_approval",toolCallId:s,approved:!0});typeof(l==null?void 0:l.send)=="function"&&l.send(g),i.addEvent({type:"approval",content:`Approved tool call ${s}`,ts:Date.now()})},[l]),V=d(s=>{let i=t.getState();i.updateApprovalStatus({toolCallId:s,status:"rejected"});let g=JSON.stringify({type:"tool_approval",toolCallId:s,approved:!1});typeof(l==null?void 0:l.send)=="function"&&l.send(g),i.addEvent({type:"approval",content:`Rejected tool call ${s}`,ts:Date.now()})},[l]);return{connection:l,store:t,send:w,clearHistory:x,sendAuth:_,setIdentity:b,toggleEventsVisible:N,clearEvents:O,approve:q,reject:V}}export{W as CLASSIFIER_DEFAULTS,Z as CLASSIFIER_RESERVED_HANDLES,B as CLEF_MODELS,ie as CRAWL_DEFAULTS,ge as CRAWL_LIMITS,Xe as DEFAULT_MEMORY_LENGTH,ze as DEFAULT_MEMORY_MODEL,bt as EVENT_PREVIEW_BYTES,_t as EXTRACT_MAX_CHARS,L as FLOW_INPUT_NAME_RE,on as GENERATION_PARAM_KEYS,an as GENERATION_PRESETS,vt as ISSUE_SEVERITY,T as MAX_USER_IDENTITY_LENGTH,Ke as MEMORY_LENGTH_MD_LINES,Qe as MEMORY_LENGTH_TOKENS,Cn as MODEL_REGISTRY_SNAPSHOT,Ce as NODE_CATALOG,$ as NodeType,de as OUT_VAR_NAME_RE,rn as PRESET_PARAM_KEYS,An as REASONING_EFFORT_LEVELS,wn as TENANT_ONLY_NODES,xt as TOOL_REGISTRY_SNAPSHOT,He as VariableResolutionError,Se as WEB_ACTIONS_DEFAULTS,fe as WEB_ACTIONS_LIMITS,Me as WEB_ACTION_EXTRACT_AS,Re as WEB_ACTION_LOCATOR_KINDS,Ae as WEB_ACTION_OPS,Ee as WEB_ACTION_SELECT_MATCH,te as WORKER_GRAPH_DEFS,ne as WORKER_GRAPH_SCHEMA,se as WORKER_OP_SCHEMA,Ct as WORKER_TEMPLATES,pn as applyPresetToOverrides,Tt as applyWorkerOps,qt as assertHttpUrl,Vt as assertPublicHttpUrl,Ht as budgetTimeout,Bt as buildClefRequest,le as buildCrawlRequestBody,In as buildReasoningProviderOptions,be as buildScope,K as buildTriggerMessageText,Mt as canonicalGraph,tt as capMemoryContent,nn as classifierErrorResult,ee as classifierHandle,wt as classifierIdFromLabel,ft as classifyIssues,Yt as classifySiteBlock,Zt as clefTruncationWarning,Ut as clipExtract,ut as collectExternalRefs,pt as collectNodeRefs,pe as crawlRequestKey,he as defaultNodeData,gn as deriveParamSupport,It as detectInlineCredentials,Lt as detectSiteBlock,zt as detectWebSession,Et as diffGraphs,At as edgeId,ht as enabledComposioSlugs,Wt as estimateClefTokens,et as estimateTokens,Pe as extractOutVarValues,Le as extractTemplateReferences,gt as extractUserKeypoints,Ne as findScopedSourceNode,Ie as firstTargetStep,h as getAgentStore,xe as getAncestorNodeIds,ve as getDefaultOutVars,me as getEffectiveOutVars,Y as getFlowInputDefs,hn as getModelEntry,Oe as getRefTail,_e as getUpstreamOutVars,_n as inspectWebPage,Ft as installWebNavigationGuard,qe as isBinaryOutVar,Ve as isJsonContentType,xn as isNodeTypeAllowedForTenant,nt as isStartMemoryEnabled,St as issueFingerprint,G as logc,at as looksLikeTranscript,rt as memoryGenerationMaxTokens,Ze as memoryMdLineLimit,We as memoryTokenLimit,lt as mergeKeypointMemory,u as messageTypes,dt as newExternalRefs,Rt as nextNodeId,jt as normalizeActionError,un as normalizeEffectiveParams,k as normalizeFlowInputs,Rn as normalizeReasoning,yn as openAiReasoningParamSupport,vn as openAiStandardParamSupport,tn as parseClefResponse,Be as parseMemoryLength,Fe as parsePayloadText,$e as parseTemplateExpression,z as parseUserAuth,Q as parseUserMessage,re as parseWorkerGraph,ae as parseWorkerOps,cn as pickNodeOverrides,De as readFetchPayload,Mn as reasoningEffortLevels,En as reasoningExposable,Nt as redact,Dt as redactedHost,Ge as resolveOutVarRef,Ue as resolveOutVarValue,ln as resolvePreset,Tn as resolveReasoningEffort,Je as resolveReference,Jt as resolveTarget,ke as resolveTemplate,ct as rewriteNodeDataRefs,Ye as rewriteTemplateNodeRefs,en as runClef,ue as runCrawl,Kt as runWebActionSteps,it as sanitizeMemoryDocument,X as sanitizeUserIdentity,oe as schemaErrors,sn as selectClefHistory,ce as shapeCrawlOutput,ot as startMemoryLength,st as startMemoryModel,fn as stripUnsupportedFromNodeData,Xt as targetPresent,Pt as toLocator,dn as toStreamTextSettings,$t as trackWebActivity,Ot as truncateForEvent,jn as useAgent,j as useAgentStore,mt as validateAuthoring,we as validateClassifierData,yt as validateFlowStructure,ye as validateOutVars,Te as validateWebActionsData,kt as vendorFromCookieNames,je as walkPath,Qt as webSessionKey,Gt as withinWebDeadline,Sn as workersAiParamSupport,mn as xaiParamSupport};
@@ -1,4 +1,4 @@
1
- export type NodeTypeName = 'startNode' | 'classifierNode' | 'memoNode' | 'llmNode' | 'answerNode' | 'apiNode' | 'toolNode' | 'workerNode' | 'crawlNode';
1
+ export type NodeTypeName = 'startNode' | 'classifierNode' | 'memoNode' | 'llmNode' | 'answerNode' | 'apiNode' | 'toolNode' | 'workerNode' | 'crawlNode' | 'webActionsNode';
2
2
  export interface AuthoringNode {
3
3
  id: string;
4
4
  type: string;
@@ -37,7 +37,7 @@ export interface GraphIssue {
37
37
  kind?: CredentialKind;
38
38
  suggestedSecret?: string;
39
39
  }
40
- export type InsertNodeType = 'memoNode' | 'llmNode' | 'apiNode' | 'toolNode' | 'workerNode' | 'crawlNode';
40
+ export type InsertNodeType = 'memoNode' | 'llmNode' | 'apiNode' | 'toolNode' | 'workerNode' | 'crawlNode' | 'webActionsNode';
41
41
  export type WorkerOp = {
42
42
  op: 'add_node';
43
43
  type: NodeTypeName;
@@ -125,7 +125,7 @@ export interface JsonSchema {
125
125
  /** Six definitions merged into any tool schema that accepts `graph` (N3). */
126
126
  export declare const WORKER_GRAPH_DEFS: {
127
127
  nodeType: {
128
- readonly enum: readonly ['startNode', 'classifierNode', 'memoNode', 'llmNode', 'answerNode', 'apiNode', 'toolNode', 'workerNode', 'crawlNode'];
128
+ readonly enum: readonly ['startNode', 'classifierNode', 'memoNode', 'llmNode', 'answerNode', 'apiNode', 'toolNode', 'workerNode', 'crawlNode', 'webActionsNode'];
129
129
  };
130
130
  nodeId: {
131
131
  readonly type: 'string';
@@ -215,7 +215,7 @@ export declare const WORKER_GRAPH_SCHEMA: {
215
215
  readonly $schema: 'https://json-schema.org/draft/2020-12/schema';
216
216
  readonly $defs: {
217
217
  nodeType: {
218
- readonly enum: readonly ['startNode', 'classifierNode', 'memoNode', 'llmNode', 'answerNode', 'apiNode', 'toolNode', 'workerNode', 'crawlNode'];
218
+ readonly enum: readonly ['startNode', 'classifierNode', 'memoNode', 'llmNode', 'answerNode', 'apiNode', 'toolNode', 'workerNode', 'crawlNode', 'webActionsNode'];
219
219
  };
220
220
  nodeId: {
221
221
  readonly type: 'string';
@@ -336,7 +336,7 @@ export declare const WORKER_OP_SCHEMA: {
336
336
  };
337
337
  readonly $defs: {
338
338
  readonly nodeType: {
339
- readonly enum: readonly ['startNode', 'classifierNode', 'memoNode', 'llmNode', 'answerNode', 'apiNode', 'toolNode', 'workerNode', 'crawlNode'];
339
+ readonly enum: readonly ['startNode', 'classifierNode', 'memoNode', 'llmNode', 'answerNode', 'apiNode', 'toolNode', 'workerNode', 'crawlNode', 'webActionsNode'];
340
340
  };
341
341
  readonly existingId: {
342
342
  readonly type: 'string';
@@ -424,7 +424,7 @@ export declare const WORKER_OP_SCHEMA: {
424
424
  readonly const: 'insert_node';
425
425
  };
426
426
  readonly type: {
427
- readonly enum: readonly ['memoNode', 'llmNode', 'apiNode', 'toolNode', 'workerNode', 'crawlNode'];
427
+ readonly enum: readonly ['memoNode', 'llmNode', 'apiNode', 'toolNode', 'workerNode', 'crawlNode', 'webActionsNode'];
428
428
  };
429
429
  readonly id: {
430
430
  readonly $ref: '#/$defs/newId';
@@ -7,6 +7,7 @@ export declare enum NodeType {
7
7
  API_NODE = "apiNode",
8
8
  TOOL_NODE = "toolNode",
9
9
  WORKER_NODE = "workerNode",
10
- CRAWL_NODE = "crawlNode"
10
+ CRAWL_NODE = "crawlNode",
11
+ WEB_ACTIONS_NODE = "webActionsNode"
11
12
  }
12
- export type NODETYPES = NodeType.START_NODE | NodeType.CLASSIFIER_NODE | NodeType.MEMO_NODE | NodeType.LLM_NODE | NodeType.ANSWER_NODE | NodeType.API_NODE | NodeType.TOOL_NODE | NodeType.WORKER_NODE | NodeType.CRAWL_NODE;
13
+ export type NODETYPES = NodeType.START_NODE | NodeType.CLASSIFIER_NODE | NodeType.MEMO_NODE | NodeType.LLM_NODE | NodeType.ANSWER_NODE | NodeType.API_NODE | NodeType.TOOL_NODE | NodeType.WORKER_NODE | NodeType.CRAWL_NODE | NodeType.WEB_ACTIONS_NODE;
@@ -0,0 +1,206 @@
1
+ import type { OutVar } from './var-scope';
2
+ /**
3
+ * How a WebActions step finds its element. Mirrors Playwright locators so the
4
+ * runtime can map each one directly (`getByTestId`, `getByRole`, ... , `locator`).
5
+ */
6
+ export type WebActionLocator = {
7
+ by: 'testId';
8
+ value: string;
9
+ } | {
10
+ by: 'role';
11
+ role: string;
12
+ name?: string;
13
+ exact?: boolean;
14
+ } | {
15
+ by: 'label';
16
+ value: string;
17
+ exact?: boolean;
18
+ } | {
19
+ by: 'placeholder';
20
+ value: string;
21
+ exact?: boolean;
22
+ } | {
23
+ by: 'text';
24
+ value: string;
25
+ exact?: boolean;
26
+ } | {
27
+ by: 'css';
28
+ value: string;
29
+ };
30
+ export type WebActionLocatorKind = WebActionLocator['by'];
31
+ /** Element picked in the builder: a primary locator, ordered fallbacks and a display hint. */
32
+ export interface WebActionTarget {
33
+ locator: WebActionLocator;
34
+ fallbacks?: WebActionLocator[];
35
+ /** What the builder showed when the element was picked. Display only. */
36
+ hint?: {
37
+ tag?: string;
38
+ type?: string;
39
+ role?: string;
40
+ name?: string;
41
+ };
42
+ }
43
+ interface WebActionBase {
44
+ /** Stable id of the step inside the node (UI keys and per-step results). */
45
+ id: string;
46
+ label?: string;
47
+ }
48
+ export type WebActionSelectMatch = 'exact' | 'startsWith' | 'contains';
49
+ export type WebAction = (WebActionBase & {
50
+ op: 'goto';
51
+ url: string;
52
+ }) | (WebActionBase & {
53
+ op: 'click';
54
+ target: WebActionTarget;
55
+ waitForNavigation?: boolean;
56
+ }) | (WebActionBase & {
57
+ op: 'fill';
58
+ target: WebActionTarget;
59
+ value: string;
60
+ }) | (WebActionBase & {
61
+ op: 'select';
62
+ target: WebActionTarget;
63
+ value: string;
64
+ match?: WebActionSelectMatch;
65
+ }) | (WebActionBase & {
66
+ op: 'check';
67
+ target: WebActionTarget;
68
+ checked: boolean | string;
69
+ }) | (WebActionBase & {
70
+ op: 'wait';
71
+ target?: WebActionTarget;
72
+ ms?: number;
73
+ }) | (WebActionBase & {
74
+ op: 'extract';
75
+ target: WebActionTarget;
76
+ as: WebActionExtractAs;
77
+ attribute?: string;
78
+ /** Key under data.extracted. */
79
+ key: string;
80
+ });
81
+ export type WebActionOp = WebAction['op'];
82
+ export type WebActionExtractAs = 'text' | 'value' | 'attribute' | 'html';
83
+ export interface WebActionsNodeData {
84
+ /** Initial page. http(s) when it contains no template. */
85
+ url: string;
86
+ actions: WebAction[];
87
+ /** Budget for the whole node run, in milliseconds. */
88
+ timeoutMs?: number;
89
+ outVars?: OutVar[];
90
+ /** Reuse the browser state (cookies, storage) across runs and skip the login steps while it still works. */
91
+ session?: WebActionsSessionConfig;
92
+ /** Headers the site owner agreed to. Values are templates and are never logged. */
93
+ headers?: {
94
+ name: string;
95
+ value: string;
96
+ }[];
97
+ }
98
+ export interface WebActionsSessionConfig {
99
+ enabled: boolean;
100
+ /** Steps [0, loginSteps) are the login block. */
101
+ loginSteps: number;
102
+ /** Bumped by "forget saved session": a new generation starts from an empty browser state. */
103
+ generation?: number;
104
+ }
105
+ export interface WebActionStepResult {
106
+ id: string;
107
+ op: WebActionOp;
108
+ ok: boolean;
109
+ ms: number;
110
+ error?: string;
111
+ /** Not executed now: 'session' = skipped thanks to a saved session; 'live' = already ran on the live inspector page. */
112
+ skipped?: 'session' | 'live';
113
+ /** Set when the failure is a bot-manager block or challenge. The run stops. */
114
+ blocked?: {
115
+ vendor: string;
116
+ kind: 'block' | 'challenge';
117
+ };
118
+ }
119
+ export interface WebActionsNodeResult {
120
+ ok: boolean;
121
+ error: string | null;
122
+ data: {
123
+ url: string;
124
+ title: string;
125
+ extracted: Record<string, unknown>;
126
+ steps: WebActionStepResult[];
127
+ } | null;
128
+ }
129
+ /** POST /ai/api/flow/web-actions/inspect body. */
130
+ export interface WebActionsInspectRequest {
131
+ /** Initial page. Templates allowed; resolved like the runtime. */
132
+ url: string;
133
+ actions: WebAction[];
134
+ /** Run actions[0..uptoIndex) before inspecting. Default: all actions. */
135
+ uptoIndex?: number;
136
+ /** Test values for non-secret refs, keyed by ref text (e.g. "start.email"). Never persisted. */
137
+ testValues?: Record<string, string>;
138
+ timeoutMs?: number;
139
+ /** Token of a live inspector browser: continue on its page when the already-run steps are unchanged. */
140
+ live?: string;
141
+ /** Close the live browser of `live` and return without inspecting. */
142
+ close?: boolean;
143
+ /** Same optional headers as the node. `{{ secrets.* }}` resolves like step values. */
144
+ headers?: {
145
+ name: string;
146
+ value: string;
147
+ }[];
148
+ }
149
+ export interface WebInspectBox {
150
+ x: number;
151
+ y: number;
152
+ width: number;
153
+ height: number;
154
+ }
155
+ export type WebInspectElementKind = 'text' | 'select' | 'checkbox' | 'radio' | 'button' | 'link' | 'other';
156
+ export interface WebInspectElement {
157
+ /** Stable within one response: "e1", "e2", ... */
158
+ id: string;
159
+ kind: WebInspectElementKind;
160
+ tag: string;
161
+ type?: string;
162
+ role?: string;
163
+ name?: string;
164
+ label?: string;
165
+ placeholder?: string;
166
+ text?: string;
167
+ /** Only for kind "select". */
168
+ options?: {
169
+ value: string;
170
+ label: string;
171
+ }[];
172
+ checked?: boolean;
173
+ /** CSS pixels relative to the screenshot (viewport) origin. */
174
+ box: WebInspectBox;
175
+ /** Locators that matched exactly this one element, best first. Never empty. */
176
+ candidates: WebActionLocator[];
177
+ /** Ops the picker offers for this element. */
178
+ ops: WebActionOp[];
179
+ }
180
+ export interface WebActionsInspectResponse {
181
+ ok: boolean;
182
+ /** Error of the step that failed while replaying, or of the inspection. */
183
+ error: string | null;
184
+ url: string;
185
+ title: string;
186
+ /** Viewport screenshot. width/height are CSS pixels (1280x800 by default). */
187
+ screenshot: {
188
+ mime: 'image/jpeg';
189
+ data: string;
190
+ width: number;
191
+ height: number;
192
+ } | null;
193
+ elements: WebInspectElement[];
194
+ steps: WebActionStepResult[];
195
+ /** Live browser kept open for the next request; null when it was closed or could not be kept. */
196
+ live?: {
197
+ token: string;
198
+ reusedSteps: number;
199
+ } | null;
200
+ /** Bot-manager block/challenge on the page, or a cookie-name hint. Null when absent. */
201
+ protection?: {
202
+ vendor: string;
203
+ kind: 'block' | 'challenge';
204
+ } | null;
205
+ }
206
+ export {};
@@ -0,0 +1,31 @@
1
+ import type { WebActionExtractAs, WebActionLocatorKind, WebActionOp, WebActionSelectMatch } from '../types/web-actions-types';
2
+ export declare const WEB_ACTIONS_DEFAULTS: {
3
+ readonly timeoutMs: 30000;
4
+ };
5
+ export declare const WEB_ACTIONS_LIMITS: {
6
+ readonly actions: 50;
7
+ readonly timeoutMs: {
8
+ readonly min: 1000;
9
+ readonly max: 120000;
10
+ };
11
+ readonly waitMs: {
12
+ readonly min: 0;
13
+ readonly max: 30000;
14
+ };
15
+ readonly fallbacks: 5;
16
+ readonly headers: 10;
17
+ readonly headerValueBytes: 4096;
18
+ };
19
+ export declare const WEB_ACTION_OPS: readonly WebActionOp[];
20
+ export declare const WEB_ACTION_LOCATOR_KINDS: readonly WebActionLocatorKind[];
21
+ export declare const WEB_ACTION_EXTRACT_AS: readonly WebActionExtractAs[];
22
+ export declare const WEB_ACTION_SELECT_MATCH: readonly WebActionSelectMatch[];
23
+ export interface WebActionsIssue {
24
+ code: 'field_type' | 'field_required' | 'field_range' | 'field_enum';
25
+ field: string;
26
+ message: string;
27
+ }
28
+ /** Structural checks for webActionsNode data shared by graph validation and the runner. URL format is checked by the caller. */
29
+ export declare function validateWebActionsData(data: Record<string, unknown>): WebActionsIssue[];
30
+ /** Index of the first step with a target in [from, to), or -1. */
31
+ export declare function firstTargetStep(actions: readonly unknown[], from: number, to?: number): number;
@@ -0,0 +1,11 @@
1
+ import { type WebPage } from './webActionsBrowser';
2
+ export interface SiteBlock {
3
+ vendor: string;
4
+ kind: 'block' | 'challenge';
5
+ }
6
+ /** Reads the open page. Does not click, type, or change anything on it. */
7
+ export declare function detectSiteBlock(page: WebPage, deadline: number): Promise<SiteBlock | null>;
8
+ /** Title, URL and a short visible excerpt. Brand signals win over a bare "Access Denied". */
9
+ export declare function classifySiteBlock(title: string, url: string, text: string): SiteBlock | null;
10
+ /** Cookie names only. The caller must not keep or return the cookie values. */
11
+ export declare function vendorFromCookieNames(names: readonly string[]): string | null;
@@ -0,0 +1,117 @@
1
+ import type { WebActionLocator, WebActionTarget } from '../types/web-actions-types';
2
+ export declare const EXTRACT_MAX_CHARS = 20000;
3
+ export declare const EVENT_PREVIEW_BYTES: number;
4
+ /** Subset of Playwright's page/locator API that WebActions actually calls. */
5
+ export interface WebLocator {
6
+ count: () => Promise<number>;
7
+ evaluate<R>(fn: (element: HTMLElement | SVGElement) => R): Promise<R>;
8
+ first: () => WebLocator;
9
+ click: (options: {
10
+ timeout: number;
11
+ }) => Promise<void>;
12
+ fill: (value: string, options: {
13
+ timeout: number;
14
+ }) => Promise<void>;
15
+ selectOption: (values: {
16
+ value: string;
17
+ } | {
18
+ label: string;
19
+ }, options: {
20
+ timeout: number;
21
+ }) => Promise<unknown>;
22
+ setChecked: (checked: boolean, options: {
23
+ timeout: number;
24
+ }) => Promise<void>;
25
+ waitFor: (options: {
26
+ state: 'visible';
27
+ timeout: number;
28
+ }) => Promise<void>;
29
+ innerText: (options: {
30
+ timeout: number;
31
+ }) => Promise<string>;
32
+ inputValue: (options: {
33
+ timeout: number;
34
+ }) => Promise<string>;
35
+ getAttribute: (name: string, options: {
36
+ timeout: number;
37
+ }) => Promise<string | null>;
38
+ innerHTML: (options: {
39
+ timeout: number;
40
+ }) => Promise<string>;
41
+ }
42
+ export interface WebRoute {
43
+ request(): {
44
+ url(): string;
45
+ isNavigationRequest(): boolean;
46
+ };
47
+ abort(errorCode?: string): Promise<void>;
48
+ continue(): Promise<void>;
49
+ }
50
+ export interface WebPage {
51
+ route(url: string, handler: (route: WebRoute) => Promise<void>): Promise<void>;
52
+ goto: (url: string, options: {
53
+ waitUntil: 'domcontentloaded';
54
+ timeout: number;
55
+ }) => Promise<unknown>;
56
+ url: () => string;
57
+ title: () => Promise<string>;
58
+ waitForNavigation: (options: {
59
+ timeout: number;
60
+ }) => Promise<unknown>;
61
+ waitForTimeout: (ms: number) => Promise<void>;
62
+ getByTestId: (value: string) => WebLocator;
63
+ getByRole(role: string, options?: {
64
+ name?: string;
65
+ exact?: boolean;
66
+ }): WebLocator;
67
+ getByLabel: (value: string, options?: {
68
+ exact?: boolean;
69
+ }) => WebLocator;
70
+ getByPlaceholder: (value: string, options?: {
71
+ exact?: boolean;
72
+ }) => WebLocator;
73
+ getByText: (value: string, options?: {
74
+ exact?: boolean;
75
+ }) => WebLocator;
76
+ locator: (value: string) => WebLocator;
77
+ }
78
+ export declare function redact(value: unknown, secrets: readonly string[]): unknown;
79
+ export declare function truncateForEvent(value: unknown): {
80
+ value: unknown;
81
+ truncated: boolean;
82
+ };
83
+ export declare function assertHttpUrl(url: string): void;
84
+ /** URL parsing normalizes alternate IPv4 spellings before the destination check. */
85
+ export declare function assertPublicHttpUrl(url: string, { allowPrivate }?: {
86
+ allowPrivate?: boolean;
87
+ }): void;
88
+ /** Guard document requests; subresources and DNS resolution are outside this policy. */
89
+ export declare function installWebNavigationGuard(page: WebPage, options: {
90
+ allowPrivate?: boolean;
91
+ }, deadline: number): Promise<void>;
92
+ export declare function redactedHost(url: string, secrets: readonly string[]): string;
93
+ /** Milliseconds left in the node budget. Exhausted budgets fail as `timeout`. */
94
+ export declare function budgetTimeout(deadline: number): number;
95
+ export declare function normalizeActionError(error: unknown): Error;
96
+ export declare function clipExtract(value: string | null): string | null;
97
+ export declare function toLocator(page: WebPage, locator: WebActionLocator): WebLocator;
98
+ /**
99
+ * Retries the locator pass until something matches or the node budget is spent.
100
+ * Within a pass, the first unique match wins; otherwise the first ambiguous match
101
+ * is used via `.first()`. A spent budget is `elemento no encontrado`.
102
+ */
103
+ export declare function resolveTarget(page: WebPage, target: WebActionTarget, deadline: number, onAmbiguous: (count: number) => void): Promise<WebLocator>;
104
+ /** Bounds Playwright operations without a native timeout (evaluate/count/launch). */
105
+ export declare function withinWebDeadline<T>(work: Promise<T>, deadline: number): Promise<T>;
106
+ export interface WebActivity {
107
+ /** Waits until in-flight requests finish and the network stays quiet, capped by `maxMs` and the deadline. Never throws. */
108
+ settle: (deadline: number, maxMs: number) => Promise<void>;
109
+ dispose: () => void;
110
+ }
111
+ /**
112
+ * Tracks page requests so steps can wait for AJAX re-renders (JSF/A4J, SPA fetches) before the next action or a capture.
113
+ * `waitForLoadState('networkidle')` cannot do this: it resolves at once after the initial load.
114
+ */
115
+ export declare function trackWebActivity(page: unknown, { quietMs }?: {
116
+ quietMs?: number;
117
+ }): WebActivity;
@@ -0,0 +1,25 @@
1
+ import type { WebAction, WebActionStepResult } from '../types/web-actions-types';
2
+ import { type WebActivity, type WebPage } from './webActionsBrowser';
3
+ export interface WebActionStepsOptions {
4
+ deadline: number;
5
+ resolve: (text: string) => string;
6
+ onAmbiguous?: (count: number, action: WebAction) => void;
7
+ sensitive?: string[];
8
+ allowPrivate?: boolean;
9
+ /** Shared request tracker; created per call when omitted. */
10
+ activity?: WebActivity;
11
+ /** Max wait for AJAX to settle after goto/click/select/check. Default 2000 ms. */
12
+ settleMs?: number;
13
+ /** Position of actions[0] in the node, for error messages when replaying a slice. */
14
+ indexOffset?: number;
15
+ }
16
+ /** Replays steps in order and stops at the first failure. Sensitive values stay with the caller. */
17
+ export declare function runWebActionSteps(page: WebPage, actions: WebAction[], options: WebActionStepsOptions): Promise<{
18
+ steps: WebActionStepResult[];
19
+ extracted: Record<string, unknown>;
20
+ error: string;
21
+ } | {
22
+ steps: WebActionStepResult[];
23
+ extracted: Record<string, unknown>;
24
+ error: null;
25
+ }>;
@@ -0,0 +1,12 @@
1
+ import type { WebInspectElement } from '../types/web-actions-types';
2
+ import { type WebPage } from './webActionsBrowser';
3
+ export interface WebInspectPage extends WebPage {
4
+ evaluate: <T, A>(fn: (arg: A) => T, arg: A) => Promise<T>;
5
+ }
6
+ /** Reads one viewport, including open shadow roots, then confirms locator uniqueness. */
7
+ export declare function inspectWebPage(page: WebInspectPage, { deadline, maxElements }: {
8
+ deadline: number;
9
+ maxElements?: number;
10
+ }): Promise<{
11
+ elements: WebInspectElement[];
12
+ }>;
@@ -0,0 +1,14 @@
1
+ import type { WebActionTarget } from '../types/web-actions-types';
2
+ import { type WebPage } from './webActionsBrowser';
3
+ /**
4
+ * Identity of a saved browser session: same tenant, same site and same login values share it.
5
+ * Values are hashed, never stored.
6
+ */
7
+ export declare function webSessionKey(tenant: string, url: string, loginValues: readonly string[], generation?: number): Promise<string>;
8
+ /** True when any locator of the target matches at least one element right now. */
9
+ export declare function targetPresent(page: WebPage, target: WebActionTarget, deadline: number): Promise<boolean>;
10
+ /**
11
+ * Decides whether the restored session still works: polls until the login element or the first
12
+ * post-login element shows up. The login element wins a tie, so a wrong guess costs a login, never a failed run.
13
+ */
14
+ export declare function detectWebSession(page: WebPage, loginTarget: WebActionTarget, postLoginTarget: WebActionTarget, deadline: number): Promise<'login' | 'session'>;
package/dist/common.d.ts CHANGED
@@ -18,9 +18,16 @@ export * from './common/utils/httpPayload';
18
18
  export * from './common/utils/agentMemory';
19
19
  export * from './common/types/crawl-types';
20
20
  export * from './common/utils/crawlClient';
21
+ export * from './common/types/web-actions-types';
22
+ export * from './common/utils/webActions';
21
23
  export * from './common/constants/tenant-only-nodes';
22
24
  export * from './common/types/classifier-types';
23
25
  export * from './common/types/classifier-validation';
24
26
  export * from './common/constants/clef-models';
25
27
  export * from './common/utils/clef';
26
28
  export * from './common/flow-graph';
29
+ export * from './common/utils/webActionsBrowser';
30
+ export * from './common/utils/webActionsBlock';
31
+ export * from './common/utils/webActionsExec';
32
+ export * from './common/utils/webActionsSession';
33
+ export * from './common/utils/webActionsInspect';
package/dist/common.js CHANGED
@@ -1 +1 @@
1
- import{a as ib,b as jb,c as kb,d as lb}from"./chunk-J67BCWE3.js";import{$ as Ca,A as ba,Aa as cb,B as ca,Ba as db,C as da,Ca as eb,D as ea,Da as fb,E as fa,Ea as gb,F as ga,Fa as hb,G as ha,H as ia,I as ja,J as ka,K as la,L as ma,M as na,N as oa,O as pa,P as qa,Q as ra,R as sa,S as ta,T as ua,U as va,V as wa,W as xa,X as ya,Y as za,Z as Aa,_ as Ba,a as b,aa as Da,b as h,ba as Ea,c as i,ca as Fa,d as j,da as Ha,e as k,ea as Ia,f as l,fa as Ja,g as m,ga as Ka,h as n,ha as La,i as o,ia as Ma,j as p,ja as Na,k as q,ka as Oa,l as r,la as Pa,m as s,ma as Qa,n as t,na as Ra,o as u,oa as Sa,p as v,pa as Ta,q as w,qa as Ua,r as x,ra as Va,s as y,sa as Wa,t as z,ta as Xa,u as A,ua as Ya,v as F,va as Za,w as G,wa as _a,x as H,xa as $a,y as $,ya as ab,z as aa,za as bb}from"./chunk-YXG3ZEUP.js";import{A as Z,B as _,a as c,b as d,c as e,d as f,e as g,f as B,g as C,h as D,i as E,j as I,k as J,l as K,m as L,n as M,o as N,p as O,q as P,r as Q,s as R,t as S,u as T,v as U,w as V,x as W,y as X,z as Y}from"./chunk-KKJW6HJA.js";import{a as Ga}from"./chunk-HJPR76HF.js";import{a}from"./chunk-U56YWPSI.js";import"./chunk-3TXHFKDN.js";export{m as CLASSIFIER_DEFAULTS,n as CLASSIFIER_RESERVED_HANDLES,l as CLEF_MODELS,v as CRAWL_DEFAULTS,w as CRAWL_LIMITS,ba as DEFAULT_MEMORY_LENGTH,ca as DEFAULT_MEMORY_MODEL,d as FLOW_INPUT_NAME_RE,Qa as GENERATION_PARAM_KEYS,Sa as GENERATION_PRESETS,ua as ISSUE_SEVERITY,i as MAX_USER_IDENTITY_LENGTH,$ as MEMORY_LENGTH_MD_LINES,aa as MEMORY_LENGTH_TOKENS,ib as MODEL_REGISTRY_SNAPSHOT,F as NODE_CATALOG,c as NodeType,B as OUT_VAR_NAME_RE,Ra as PRESET_PARAM_KEYS,cb as REASONING_EFFORT_LEVELS,kb as TENANT_ONLY_NODES,Ia as TOOL_REGISTRY_SNAPSHOT,R as VariableResolutionError,p as WORKER_GRAPH_DEFS,q as WORKER_GRAPH_SCHEMA,r as WORKER_OP_SCHEMA,Fa as WORKER_TEMPLATES,Va as applyPresetToOverrides,Da as applyWorkerOps,Ja as buildClefRequest,x as buildCrawlRequestBody,hb as buildReasoningProviderOptions,K as buildScope,g as buildTriggerMessageText,Ba as canonicalGraph,ha as capMemoryContent,Oa as classifierErrorResult,o as classifierHandle,Ha as classifierIdFromLabel,ya as classifyIssues,La as clefTruncationWarning,sa as collectExternalRefs,qa as collectNodeRefs,y as crawlRequestKey,G as defaultNodeData,Ta as deriveParamSupport,Ea as detectInlineCredentials,Ca as diffGraphs,za as edgeId,Ga as enabledComposioSlugs,Ka as estimateClefTokens,ga as estimateTokens,U as extractOutVarValues,Y as extractTemplateReferences,oa as extractUserKeypoints,L as findScopedSourceNode,I as getAncestorNodeIds,C as getDefaultOutVars,E as getEffectiveOutVars,e as getFlowInputDefs,jb as getModelEntry,M as getRefTail,J as getUpstreamOutVars,N as isBinaryOutVar,O as isJsonContentType,lb as isNodeTypeAllowedForTenant,ia as isStartMemoryEnabled,xa as issueFingerprint,a as logc,ma as looksLikeTranscript,la as memoryGenerationMaxTokens,fa as memoryMdLineLimit,ea as memoryTokenLimit,pa as mergeKeypointMemory,b as messageTypes,ta as newExternalRefs,Aa as nextNodeId,Xa as normalizeEffectiveParams,f as normalizeFlowInputs,db as normalizeReasoning,_a as openAiReasoningParamSupport,Za as openAiStandardParamSupport,Na as parseClefResponse,da as parseMemoryLength,P as parsePayloadText,X as parseTemplateExpression,k as parseUserAuth,h as parseUserMessage,t as parseWorkerGraph,u as parseWorkerOps,Wa as pickNodeOverrides,Q as readFetchPayload,eb as reasoningEffortLevels,fb as reasoningExposable,W as resolveOutVarRef,T as resolveOutVarValue,Ua as resolvePreset,gb as resolveReasoningEffort,V as resolveReference,_ as resolveTemplate,ra as rewriteNodeDataRefs,Z as rewriteTemplateNodeRefs,Ma as runClef,A as runCrawl,na as sanitizeMemoryDocument,j as sanitizeUserIdentity,s as schemaErrors,Pa as selectClefHistory,z as shapeCrawlOutput,ka as startMemoryLength,ja as startMemoryModel,bb as stripUnsupportedFromNodeData,Ya as toStreamTextSettings,wa as validateAuthoring,H as validateClassifierData,va as validateFlowStructure,D as validateOutVars,S as walkPath,ab as workersAiParamSupport,$a as xaiParamSupport};
1
+ import{a as Mb,b as Nb,c as Ob,d as Pb,e as Qb}from"./chunk-GHMAKIZO.js";import{$ as Ca,$a as Db,A as K,Aa as cb,B as L,Ba as db,C as M,Ca as eb,D as N,Da as fb,E as O,Ea as gb,F as P,Fa as hb,G as ha,Ga as ib,H as ia,Ha as jb,I as ja,Ia as kb,J as ka,Ja as lb,K as la,Ka as mb,L as ma,La as nb,M as na,Ma as ob,N as oa,Na as pb,O as pa,Oa as qb,P as qa,Pa as rb,Q as ra,Qa as sb,R as sa,Ra as tb,S as ta,Sa as ub,T as ua,Ta as vb,U as va,Ua as wb,V as wa,Va as xb,W as xa,Wa as yb,X as ya,Xa as zb,Y as za,Ya as Ab,Z as Aa,Za as Bb,_ as Ba,_a as Cb,a as b,aa as Da,ab as Eb,b as h,ba as Ea,bb as Fb,c as i,ca as Fa,cb as Gb,d as j,da as Ga,db as Hb,e as k,ea as Ha,eb as Ib,f as l,fa as Ia,fb as Jb,g as m,ga as Ja,gb as Kb,h as n,ha as Ka,hb as Lb,i as o,ia as La,j as p,ja as Ma,k as q,ka as Na,l as r,la as Pa,m as s,ma as Qa,n as t,na as Ra,o as u,oa as Sa,p as v,pa as Ta,q as w,qa as Ua,r as x,ra as Va,s as y,sa as Wa,t as z,ta as Xa,u as A,ua as Ya,v as F,va as Za,w as G,wa as _a,x as H,xa as $a,y as I,ya as ab,z as J,za as bb}from"./chunk-G73VSMK7.js";import{A as fa,B as ga,a as c,b as d,c as e,d as f,e as g,f as B,g as C,h as D,i as E,j as Q,k as R,l as S,m as T,n as U,o as V,p as W,q as X,r as Y,s as Z,t as _,u as $,v as aa,w as ba,x as ca,y as da,z as ea}from"./chunk-LUS5CJY2.js";import{a as Oa}from"./chunk-HJPR76HF.js";import{a}from"./chunk-U56YWPSI.js";import"./chunk-3TXHFKDN.js";export{m as CLASSIFIER_DEFAULTS,n as CLASSIFIER_RESERVED_HANDLES,l as CLEF_MODELS,v as CRAWL_DEFAULTS,w as CRAWL_LIMITS,ja as DEFAULT_MEMORY_LENGTH,ka as DEFAULT_MEMORY_MODEL,Sa as EVENT_PREVIEW_BYTES,Ra as EXTRACT_MAX_CHARS,d as FLOW_INPUT_NAME_RE,sb as GENERATION_PARAM_KEYS,ub as GENERATION_PRESETS,Ca as ISSUE_SEVERITY,i as MAX_USER_IDENTITY_LENGTH,ha as MEMORY_LENGTH_MD_LINES,ia as MEMORY_LENGTH_TOKENS,Mb as MODEL_REGISTRY_SNAPSHOT,N as NODE_CATALOG,c as NodeType,B as OUT_VAR_NAME_RE,tb as PRESET_PARAM_KEYS,Gb as REASONING_EFFORT_LEVELS,Ob as TENANT_ONLY_NODES,Qa as TOOL_REGISTRY_SNAPSHOT,Z as VariableResolutionError,F as WEB_ACTIONS_DEFAULTS,G as WEB_ACTIONS_LIMITS,J as WEB_ACTION_EXTRACT_AS,I as WEB_ACTION_LOCATOR_KINDS,H as WEB_ACTION_OPS,K as WEB_ACTION_SELECT_MATCH,p as WORKER_GRAPH_DEFS,q as WORKER_GRAPH_SCHEMA,r as WORKER_OP_SCHEMA,Na as WORKER_TEMPLATES,xb as applyPresetToOverrides,La as applyWorkerOps,Va as assertHttpUrl,Wa as assertPublicHttpUrl,Za as budgetTimeout,lb as buildClefRequest,x as buildCrawlRequestBody,Lb as buildReasoningProviderOptions,S as buildScope,g as buildTriggerMessageText,Ja as canonicalGraph,pa as capMemoryContent,qb as classifierErrorResult,o as classifierHandle,Pa as classifierIdFromLabel,Ga as classifyIssues,fb as classifySiteBlock,nb as clefTruncationWarning,$a as clipExtract,Aa as collectExternalRefs,ya as collectNodeRefs,y as crawlRequestKey,O as defaultNodeData,vb as deriveParamSupport,Ma as detectInlineCredentials,eb as detectSiteBlock,kb as detectWebSession,Ka as diffGraphs,Ha as edgeId,Oa as enabledComposioSlugs,mb as estimateClefTokens,oa as estimateTokens,aa as extractOutVarValues,ea as extractTemplateReferences,wa as extractUserKeypoints,T as findScopedSourceNode,M as firstTargetStep,Q as getAncestorNodeIds,C as getDefaultOutVars,E as getEffectiveOutVars,e as getFlowInputDefs,Nb as getModelEntry,U as getRefTail,R as getUpstreamOutVars,Qb as inspectWebPage,Xa as installWebNavigationGuard,V as isBinaryOutVar,W as isJsonContentType,Pb as isNodeTypeAllowedForTenant,qa as isStartMemoryEnabled,Fa as issueFingerprint,a as logc,ua as looksLikeTranscript,ta as memoryGenerationMaxTokens,na as memoryMdLineLimit,ma as memoryTokenLimit,xa as mergeKeypointMemory,b as messageTypes,Ba as newExternalRefs,Ia as nextNodeId,_a as normalizeActionError,zb as normalizeEffectiveParams,f as normalizeFlowInputs,Hb as normalizeReasoning,Cb as openAiReasoningParamSupport,Bb as openAiStandardParamSupport,pb as parseClefResponse,la as parseMemoryLength,X as parsePayloadText,da as parseTemplateExpression,k as parseUserAuth,h as parseUserMessage,t as parseWorkerGraph,u as parseWorkerOps,yb as pickNodeOverrides,Y as readFetchPayload,Ib as reasoningEffortLevels,Jb as reasoningExposable,Ta as redact,Ya as redactedHost,ca as resolveOutVarRef,$ as resolveOutVarValue,wb as resolvePreset,Kb as resolveReasoningEffort,ba as resolveReference,bb as resolveTarget,ga as resolveTemplate,za as rewriteNodeDataRefs,fa as rewriteTemplateNodeRefs,ob as runClef,A as runCrawl,hb as runWebActionSteps,va as sanitizeMemoryDocument,j as sanitizeUserIdentity,s as schemaErrors,rb as selectClefHistory,z as shapeCrawlOutput,sa as startMemoryLength,ra as startMemoryModel,Fb as stripUnsupportedFromNodeData,jb as targetPresent,ab as toLocator,Ab as toStreamTextSettings,db as trackWebActivity,Ua as truncateForEvent,Ea as validateAuthoring,P as validateClassifierData,Da as validateFlowStructure,D as validateOutVars,L as validateWebActionsData,gb as vendorFromCookieNames,_ as walkPath,ib as webSessionKey,cb as withinWebDeadline,Eb as workersAiParamSupport,Db as xaiParamSupport};
@@ -0,0 +1 @@
1
+ import{d as a,e as b}from"./chunk-62G7NURX.js";import"./chunk-LUS5CJY2.js";import"./chunk-V6JSMX5A.js";import"./chunk-U56YWPSI.js";import"./chunk-3TXHFKDN.js";export{a as customHttpTool,b as default};
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from './server/tools/tempTool';
3
3
  export * from './server/tools/twitter';
4
4
  export * from './server/tools/vectorize';
5
5
  export * from './server/core/AgentDO';
6
+ export * from './server/core/WebSessionDO';
6
7
  export * from './server/core/agentTurn';
7
8
  export * from './server/logic/serverMessages';
8
9
  export * from './server/logic/FlowEngine';