@zibby/agent-workflow 2.0.3 → 2.0.5
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/code-generator.js +15 -15
- package/dist/fetch-deadline.d.ts +78 -0
- package/dist/fetch-deadline.js +1 -0
- package/dist/graph-compiler.js +24 -24
- package/dist/graph.js +22 -22
- package/dist/in-process-subgraph.d.ts +1 -1
- package/dist/in-process-subgraph.js +1 -1
- package/dist/index.js +33 -33
- package/dist/logger.d.ts +26 -0
- package/dist/logger.js +1 -1
- package/dist/node-registry.js +8 -8
- package/dist/node.d.ts +1 -11
- package/dist/node.js +16 -16
- package/dist/strategy-registry.js +8 -8
- package/dist/sub-graph-executor.d.ts +2 -0
- package/dist/sub-graph-executor.js +1 -1
- package/dist/tool-resolver.js +1 -1
- package/package.json +1 -1
package/dist/code-generator.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
var
|
|
1
|
+
var H=Object.defineProperty;var x=(e,n,o)=>()=>{if(o)throw o[0];try{return e&&(n=e(e=0)),n}catch(r){throw o=[r],r}};var J=(e,n)=>{for(var o in n)H(e,o,{get:n[o],enumerable:!0})};function O(e){return q.get(e)||null}var A,I,q,pe,j=x(()=>{A=Symbol.for("@zibby/agent-workflow.skills"),I=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[A]||(globalThis[A]=new Map);globalThis[I]||(globalThis[I]=new Map);q=globalThis[A],pe=globalThis[I]});var L,Z,C,_,N,R=x(()=>{L=()=>{},Z={debug:L,info:L,warn:(...e)=>console.warn("[workflow]",...e),error:(...e)=>console.error("[workflow]",...e)},C=Symbol.for("@zibby/agent-workflow.logger");globalThis[C]||(globalThis[C]={impl:Z});_=globalThis[C],N={debug:(...e)=>_.impl.debug?.(...e),info:(...e)=>_.impl.info?.(...e),warn:(...e)=>_.impl.warn?.(...e),error:(...e)=>_.impl.error?.(...e)}});var z=x(()=>{});var Y={};J(Y,{getAgentStrategy:()=>F,invokeAgent:()=>ee,listStrategies:()=>X,registerStrategy:()=>Q,resolveInvocationExtras:()=>B,resolveInvocationModel:()=>G});function Q(e){if(!e||typeof e.getName!="function"||typeof e.invoke!="function")throw new Error("strategy must implement getName() and invoke() (AgentStrategy shape)");let n=k.findIndex(o=>o.getName()===e.getName());n>=0?k[n]=e:k.push(e)}function X(){return k.map(e=>e.getName())}function G({config:e={},options:n={},strategyName:o,envModel:r,nodeConfigModel:i}={}){let s=e.models||{},t=typeof i=="string"&&i.trim()?i.trim():null,c=n.nodeName&&s[n.nodeName]||null,a=s.default||null,l=e.agent?.[o]?.model||null,h=(typeof r=="string"?r.trim():"")||null;return t||c||a||l||n.model||h||null}function B({options:e={},stateView:n={},context:o={}}={}){return{workspace:n.workspace||e.workspace,schema:e.schema||o.schema,images:e.images||o.images||[],skills:e.skills||o.skills||[],extraMcpServers:e.extraMcpServers||n.extraMcpServers||o.extraMcpServers||[],plugins:e.plugins||o.plugins||[]}}function F(e={}){let{state:n={},preferredAgent:o=null}=e,r=o||n.agentType||process.env.AGENT_TYPE;if(!r){let s=k.map(t=>t.getName()).join(", ")||"none registered";throw new Error(`No agent specified. Set agentType in state or AGENT_TYPE env var. Available: ${s}`)}N.debug(`[workflow] agent selection: requested=${r}`);let i=k.find(s=>s.getName()===r);if(!i){let s=k.map(t=>t.getName()).join(", ")||"none registered";throw new Error(`Unknown agent '${r}'. Available: ${s}`)}if(!i.canHandle(e))throw new Error(`Agent '${r}' is not available in this environment. Check credentials/environment.`);return N.debug(`[workflow] using agent: ${i.getName()}`),i}async function ee(e,n={},o={}){let r=n.state&&typeof n.state.getAll=="function"?n.state.getAll():n.state||{},i={...n,state:r},s=F(i),t=r.config||o.config||{},c=r._currentNodeConfig||{},a=typeof c.agent=="string"?c.agent.trim():"",l=!a||a===s.name?c.model:null,h=G({config:t,options:o,strategyName:s.name,envModel:process.env.MODEL,nodeConfigModel:l}),T={...o,model:h,...B({options:o,stateView:r,context:n}),config:t},m=e,b=T.skills||[];if(b.length>0&&!o.skipPromptFragments){let f=o.connectedIntegrations;if(!f){let p=process.env.WORKFLOW_CONNECTED_INTEGRATIONS;if(typeof p=="string"&&p.trim()!==""){f={};for(let g of p.split(",").map(w=>w.trim()).filter(Boolean))f[g]=!0}}let y=p=>{let g=p&&p.requiresIntegration;return!g||!f?!0:(Array.isArray(g)?g:[g]).some(E=>f[E]===!0)},u=s.name==="assistant",v=p=>p?.inProcessOnly!==!0||u,$=b.map(p=>{let g=O(p);if(!y(g)||!v(g))return null;let w=g?.promptFragment;return typeof w=="function"?w():w}).filter(Boolean);$.length>0&&(m+=`
|
|
2
2
|
|
|
3
3
|
${$.join(`
|
|
4
4
|
|
|
5
|
-
`)}`)}let d=r._currentNodeConfig?.stores;if(Array.isArray(d)&&d.length>0&&typeof d[0]=="object"){let
|
|
5
|
+
`)}`)}let d=r._currentNodeConfig?.stores;if(Array.isArray(d)&&d.length>0&&typeof d[0]=="object"){let f=d.length<=8,y=d.map(u=>{let v=u?.id??u?.storeId??"",$=(u?.name??"").toString().trim()||v,p=u?.type?` \xB7 ${u.type}`:"",g=(u?.description||"").toString().replace(/\s+/g," ").trim(),w=`- ${$} \xB7 ${g||"(no description)"}${p} (id: ${v})`;if(f&&u?.schema&&typeof u.schema=="object"){let E=u.schema.properties&&typeof u.schema.properties=="object"?Object.keys(u.schema.properties):Object.keys(u.schema);E.length&&(w+=`
|
|
6
6
|
fields: ${E.join(", ")}`)}return w});m+=`
|
|
7
7
|
|
|
8
8
|
AVAILABLE STORES (pick a store by its description and pass its NAME to the store tool):
|
|
9
9
|
${y.join(`
|
|
10
|
-
`)}`}let
|
|
10
|
+
`)}`}let S=r._currentNodeConfig?.extraPromptInstructions?.trim();return S&&(m+=`
|
|
11
11
|
|
|
12
12
|
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
13
13
|
PRIORITY OVERRIDE \u2014 THE FOLLOWING INSTRUCTIONS TAKE PRECEDENCE OVER ALL PREVIOUS CONTENT
|
|
14
14
|
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
15
15
|
|
|
16
|
-
${
|
|
17
|
-
`),
|
|
18
|
-
${h}`),c.includes(".")||
|
|
16
|
+
${S}
|
|
17
|
+
`),N.debug(`[workflow] prompt length: ${m.length} chars`),s.invoke(m,T)}var P,k,U=x(()=>{z();R();j();P=Symbol.for("@zibby/agent-workflow.strategies");globalThis[P]||(globalThis[P]=[]);k=globalThis[P]});j();R();var D={};var M=Symbol.for("@zibby/agent-workflow.nodes");globalThis[M]||(globalThis[M]=new Map);var V=globalThis[M];function ne(e,n){V.set(e,n)}function K(e){let n=V.get(e);return n?n.factory&&typeof n.create=="function"?n.create.toString():typeof n.execute=="function"?n.execute.toString():typeof n=="function"?n.toString():null:null}ne("ai_agent",{name:"ai_agent",factory:!0,create:(e,n={})=>({name:e,_isCustomCode:!0,execute:async o=>{let r=o?._coreInvokeAgent;r||(r=(await Promise.resolve().then(()=>(U(),Y))).invokeAgent);let i=n.extraPromptInstructions||"Execute the task based on the current state.",s=oe(i,o),t=await r(s,{cwd:o.workspace||process.cwd(),model:o.model,tools:n.resolvedTools||null});return{success:!0,output:{raw:t,nodeId:e},raw:typeof t=="string"?t:t.raw}}})});function oe(e,n){let o=/@([\w.]+)/g,r=new Set,i;for(;(i=o.exec(e))!==null;)r.add(i[1]);if(r.size===0)return e;let s=[],t=new Set;for(let c of r){let a=c.split(".")[0];if(t.has(a))continue;let l=c.split(".").reduce((m,b)=>m?.[b],n);if(l===void 0)continue;let h=typeof l=="string"?l:l?.raw??JSON.stringify(l,null,2),T=c.replace(/_/g," ").replace(/\b\w/g,m=>m.toUpperCase());s.push(`## ${T}
|
|
18
|
+
${h}`),c.includes(".")||t.add(a)}return s.length===0?e:`${e}
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
# Referenced Context
|
|
22
22
|
|
|
23
23
|
${s.join(`
|
|
24
24
|
|
|
25
|
-
`)}`}function
|
|
26
|
-
`)}function
|
|
27
|
-
`)}function
|
|
28
|
-
`)}function
|
|
29
|
-
`)}function
|
|
30
|
-
`)}function
|
|
31
|
-
`)}function
|
|
25
|
+
`)}`}function xe(e,n={}){let{nodes:o,edges:r,nodeConfigs:i={}}=e,s=new Set,t=[],c=new Map;for(let f of o){let y=f.data?.nodeType||f.type;c.set(f.id,y),y==="decision"?s.add(f.id):t.push({id:f.id,nodeType:y,label:f.data?.label||f.id})}let a=t.some(f=>{let y=i[f.id]||{};return!y.customCode&&!y.executeCode}),{toolsPerNode:l,toolIdsByVar:h}=le(t,i),{simpleEdges:T,conditionalEdges:m}=fe(r,s),b=ue(t,r,s),d=[],S=n.workflowType||"workflow";return d.push(te(n)),d.push(re(S,{usesRegisteredNodes:a})),d.push(se(h)),d.push(ie(S)),d.push(ae(t,i)),d.push(ce(t,b,T,m,l,S)),d.filter(Boolean).join(`
|
|
26
|
+
`)}function _e(e){let n={};for(let[o,r]of Object.entries(e)){let{tools:i,...s}=r;Object.keys(s).length>0&&(n[o]=s)}return n}function te(e){let n=e.workflowType||"workflow";return["// Generated workflow",`// ${e.projectId?`Project: ${e.projectId} | `:""}Type: ${n} | Version: ${e.version??0}`,`// Downloaded: ${new Date().toISOString()}`,""].join(`
|
|
27
|
+
`)}function re(e,{usesRegisteredNodes:n=!0}={}){let o=["import { WorkflowGraph, invokeAgent, getResolvedToolDefinitions } from '@zibby/agent-workflow';"];return n&&o.push("// import './register-nodes.js'; // register custom node types here"),o.push("import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';","import { join, dirname } from 'node:path';","import { fileURLToPath } from 'node:url';",""),o.join(`
|
|
28
|
+
`)}function se(e){if(e.size===0)return"";let n=["// \u2500\u2500 Tool Bindings \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"];for(let[o,r]of e)n.push(`const ${o} = getResolvedToolDefinitions(${JSON.stringify(r)}); // ${r.join(", ")}`);return n.push(""),n.join(`
|
|
29
|
+
`)}function ie(e){return["// \u2500\u2500 Node Configs \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500","const __filename = fileURLToPath(import.meta.url);","const __dirname = dirname(__filename);",`const configPath = join(__dirname, 'workflow-${e}.config.json');`,"const nodeConfigs = existsSync(configPath) ? JSON.parse(readFileSync(configPath, 'utf-8')) : {};",""].join(`
|
|
30
|
+
`)}function ae(e,n){let o=["// \u2500\u2500 Node Implementations \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",""];for(let r of e){let i=W(r.id),s=n[r.id]?.customCode;if(s)o.push(`// @custom \u2014 modified from default "${r.nodeType}" template`),o.push(`const ${i}_execute = ${s};`);else{let t=K(r.nodeType);t?(o.push(`// Default "${r.nodeType}" implementation`),o.push(`const ${i}_execute = ${t};`)):(o.push(`// No template for "${r.nodeType}" \u2014 passthrough`),o.push(`const ${i}_execute = async (state) => ({ success: true, output: {}, raw: null });`))}o.push("")}return o.join(`
|
|
31
|
+
`)}function ce(e,n,o,r,i,s){let t=["// \u2500\u2500 Graph Builder \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"];t.push("export function buildGraph(options = {}) {"),t.push(" const graph = new WorkflowGraph(options);",""),t.push(" // Nodes");for(let a of e){let l=W(a.id);t.push(` graph.addNode('${a.id}', { name: '${a.id}', execute: ${l}_execute });`),t.push(` graph.setNodeType('${a.id}', '${a.nodeType}');`)}t.push("",` graph.setEntryPoint('${n}');`,""),(o.length>0||r.length>0)&&t.push(" // Edges");for(let a of o)t.push(` graph.addEdge('${a.source}', '${a.target}');`);for(let a of r){let l=a.code.split(`
|
|
32
32
|
`).map((h,T)=>T===0?h:` ${h}`).join(`
|
|
33
|
-
`);
|
|
34
|
-
`)}function
|
|
33
|
+
`);t.push(` graph.addConditionalEdges('${a.source}', ${l});`)}let c=[];for(let a of e){let l=i.get(a.id);l&&c.push(` '${a.id}': ${l},`)}return c.length>0&&t.push(""," graph.resolvedToolsMap = {",...c," };"),t.push(""," return graph;","}",""),t.push("export { nodeConfigs };",""),t.join(`
|
|
34
|
+
`)}function le(e,n){let o=new Map,r=new Map;for(let i of e){let s=n[i.id]?.tools,t;if(Array.isArray(s)&&s.length>0)t=[...s].sort();else{let c=D[i.nodeType];c?.length>0&&(t=[...c].sort())}if(t){let c=`${t.map(a=>a.replace(/[^a-zA-Z0-9]/g,"")).join("And")}Tools`;o.set(i.id,c),r.has(c)||r.set(c,t)}}return{toolsPerNode:o,toolIdsByVar:r}}function fe(e,n){let o=[],r=[],i=new Map,s=new Set;for(let t of e)i.has(t.source)||i.set(t.source,[]),i.get(t.source).push(t);for(let t of e)if(!n.has(t.source))if(n.has(t.target)){if(s.has(t.target))continue;s.add(t.target);let a=(i.get(t.target)||[]).find(l=>l.data?.conditionalCode||l.conditionalCode);a&&r.push({source:t.source,code:a.data?.conditionalCode||a.conditionalCode})}else o.push({source:t.source,target:t.target});return{simpleEdges:o,conditionalEdges:r}}function ue(e,n,o){let r=new Set;for(let s of n)o.has(s.target)||r.add(s.target);let i=e.find(s=>!r.has(s.id));return i?i.id:e[0]?.id}function W(e){return e.replace(/[^a-zA-Z0-9]/g,"_")}export{_e as generateNodeConfigsJson,xe as generateWorkflowCode};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch deadlines — the ONE declaration, so the engine's HTTP doors cannot
|
|
3
|
+
* drift apart.
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* WHY THIS FILE EXISTS AT ALL. Node's global fetch has NO default timeout, and
|
|
7
|
+
* A HANG IS NOT A THROW: a connection that is accepted and then never answered
|
|
8
|
+
* is not an error any `catch` can see, it is a process that stops. Every HTTP
|
|
9
|
+
* door in this engine is already written for failure — a trigger rejection is
|
|
10
|
+
* booked per-child by the caller's `Promise.allSettled`, a poll transport throw
|
|
11
|
+
* is retried, a `begin` failure falls back to the HTTP path — and NONE of that
|
|
12
|
+
* code can run for the one failure mode that actually costs a run.
|
|
13
|
+
*
|
|
14
|
+
* MEASURED, not hypothetical: board-runner run 4b49371e (2026-08-24) sat 7m33s
|
|
15
|
+
* inside the identical unbounded shape until the container watchdog killed it,
|
|
16
|
+
* and a tick that had already done all of its work recorded nothing. The same
|
|
17
|
+
* class has been closed in workflow-templates' lib/kb.js (d7e3184),
|
|
18
|
+
* lib/platform-api.js (7a355cc), _shared/tracker.js (539483e) and
|
|
19
|
+
* @zibby/core's backend-client.js.
|
|
20
|
+
*
|
|
21
|
+
* WHY THE HELPERS LIVE HERE AND NOT NEXT TO THEIR CALL SITES. The engine has
|
|
22
|
+
* two files that dispatch a child — `sub-graph-executor.ts` (HTTP) and
|
|
23
|
+
* `in-process-subgraph.ts` (in-process, which FALLS BACK to the other) — and
|
|
24
|
+
* they are two halves of one dispatch. Copying a clamp, a `TimeoutError` check
|
|
25
|
+
* and a budget into both is precisely the TWO-PLACES shape that produced every
|
|
26
|
+
* incident this rule was written for: a pair that must agree with nothing to
|
|
27
|
+
* scream when it drifts. One declaration, N consumers, no tripwire needed
|
|
28
|
+
* because there is nothing to keep in sync.
|
|
29
|
+
*
|
|
30
|
+
* ⚠️ Deliberately DEPENDENCY-FREE (not even the logger) so any module can
|
|
31
|
+
* import it without a cycle — `in-process-subgraph.ts` is imported BY
|
|
32
|
+
* `sub-graph-executor.ts`, so the budgets could not have lived in the latter.
|
|
33
|
+
*/
|
|
34
|
+
export declare const SUBGRAPH_TRIGGER_TIMEOUT_MS = 30000;
|
|
35
|
+
export declare const SUBGRAPH_POLL_TIMEOUT_MS = 15000;
|
|
36
|
+
export declare const SUBGRAPH_BUNDLE_TIMEOUT_MS = 60000;
|
|
37
|
+
/** curl's connect phase only — a stalled DNS/TCP handshake, distinct from a
|
|
38
|
+
* slow but progressing transfer. Not separately overridable: it is a fixed
|
|
39
|
+
* fraction of the class, and one more knob would be one more thing to drift. */
|
|
40
|
+
export declare const SUBGRAPH_CONNECT_TIMEOUT_MS = 10000;
|
|
41
|
+
export declare const TIMEOUT_FLOOR_MS = 1000;
|
|
42
|
+
export declare const TIMEOUT_CEILING_MS = 120000;
|
|
43
|
+
/**
|
|
44
|
+
* Read a budget from the environment, or fall back. Clamped to
|
|
45
|
+
* [TIMEOUT_FLOOR_MS, TIMEOUT_CEILING_MS]; anything unparseable or non-positive
|
|
46
|
+
* (`0`, `-1`, `''`, `'soon'`) falls back rather than disabling the bound.
|
|
47
|
+
*/
|
|
48
|
+
export declare function timeoutMsFrom(knob: string, fallback: number, env?: any): number;
|
|
49
|
+
/**
|
|
50
|
+
* ONE deadline for ONE call: the `signal` the request AND its body reads share
|
|
51
|
+
* — a response whose headers arrive and whose body then stalls is the same
|
|
52
|
+
* hang, and bounding only the first half leaves the door open — plus the
|
|
53
|
+
* `label` a timeout reports itself with.
|
|
54
|
+
*
|
|
55
|
+
* The label names the budget AND its knob because whoever reads the run log has
|
|
56
|
+
* to tell a SLOW control plane (raise the knob, or accept the failure) from a
|
|
57
|
+
* BROKEN one (an ordinary transport error, which keeps its existing wording).
|
|
58
|
+
* One spelling for both is how a hang stays invisible for as long as this one
|
|
59
|
+
* did.
|
|
60
|
+
*/
|
|
61
|
+
export declare function makeDeadline(ms: number, knob: string): {
|
|
62
|
+
signal: AbortSignal;
|
|
63
|
+
label: string;
|
|
64
|
+
};
|
|
65
|
+
/** Build a deadline straight from a knob + default. */
|
|
66
|
+
export declare function deadlineFor(knob: string, fallback: number): {
|
|
67
|
+
signal: AbortSignal;
|
|
68
|
+
label: string;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* `AbortSignal.timeout` aborts with a `TimeoutError` DOMException (undici
|
|
72
|
+
* rejects the fetch — and any in-flight body read — with that same reason); a
|
|
73
|
+
* caller-cancelled signal aborts with `AbortError`. Both mean "we stopped
|
|
74
|
+
* waiting"; NEITHER means "the far end said no", which is why every call site
|
|
75
|
+
* branches on this before deciding whether to reword an error or rethrow it
|
|
76
|
+
* unchanged.
|
|
77
|
+
*/
|
|
78
|
+
export declare function isTimeoutError(err: any): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i=3e4,M=15e3,T=6e4,u=1e4,s=1e3,E=12e4;function o(t,r,e=process.env){let n=Number(e[t]);return Number.isFinite(n)&&n>0?Math.min(12e4,Math.max(1e3,Math.floor(n))):r}function _(t,r){return{signal:AbortSignal.timeout(t),label:`after ${t}ms (${r})`}}function a(t,r){return _(o(t,r),t)}function m(t){return t?.name==="TimeoutError"||t?.name==="AbortError"}export{T as SUBGRAPH_BUNDLE_TIMEOUT_MS,u as SUBGRAPH_CONNECT_TIMEOUT_MS,M as SUBGRAPH_POLL_TIMEOUT_MS,i as SUBGRAPH_TRIGGER_TIMEOUT_MS,E as TIMEOUT_CEILING_MS,s as TIMEOUT_FLOOR_MS,a as deadlineFor,m as isTimeoutError,_ as makeDeadline,o as timeoutMsFrom};
|