feat: n8n community node for TinyFish Web Agent#4
Conversation
- Node with 5 operations: Run SSE, Run Sync, Run Async, Get Run, List Runs - Credential with API key auth and connection test - Options: browser profile (lite/stealth), proxy, timeout - usableAsTool support for n8n AI Agent - README with configuration, usage, and contributing guide
📝 WalkthroughWalkthroughThis pull request introduces a complete n8n node package for TinyFish Web Agent integration. The addition includes a new credential type (TinyfishApi) for API authentication, a main node implementation (Tinyfish) supporting five operations (runSse, runSync, runAsync, getRun, listRuns), helper utilities for API requests and SSE stream consumption, UI field definitions, build configuration, and comprehensive documentation. The package is configured for TypeScript compilation and distribution, with npm publishing support. Sequence Diagram(s)sequenceDiagram
participant n8n as n8n Executor
participant Node as Tinyfish Node
participant API as TinyFish API
participant SSE as SSE Stream
n8n->>Node: execute(operation: 'runSse', params)
Node->>Node: buildAutomationPayload()
Node->>API: tinyfishApiRequest(POST /v1/automation/run-sse)
API-->>Node: { streamingUrl, runId }
Node->>SSE: fetch(streamingUrl) with AbortController
SSE->>Node: stream SSE events (progress, result)
Node->>Node: parseJsonLines() on each event
Node->>Node: track runId, progress
SSE->>Node: COMPLETE event
Node-->>n8n: return structured result
n8n->>Node: execute(operation: 'runSync', params)
Node->>Node: buildAutomationPayload()
Node->>API: tinyfishApiRequest(POST /v1/automation/run)
API-->>API: process synchronously
API-->>Node: { runId, result, status }
Node-->>n8n: return execution data
n8n->>Node: execute(operation: 'listRuns')
Node->>API: tinyfishApiRequest(GET /v1/runs, params)
API-->>API: pagination loop
API-->>Node: { runs, cursor }
Node->>Node: accumulate results or apply limit
Node-->>n8n: return runs array
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (3)
n8n/.gitignore (1)
1-4: Consider adding additional common ignore patterns.The current .gitignore covers the essentials, but you may want to add entries for environment files and IDE configurations to prevent accidental commits.
💡 Suggested additions
node_modules/ dist/ *.js.map .DS_Store +.env +.env.* +*.log +.idea/ +.vscode/🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@n8n/.gitignore` around lines 1 - 4, Update the repository .gitignore to include common sensitive and IDE/runtime artifacts in addition to the current entries; add patterns such as .env, .env.* (or .env.local), .envrc, .vscode/, .idea/, .venv/, .pytest_cache/, .cache/, coverage/ and *.log to prevent committing environment files, IDE settings, virtualenvs, test caches, coverage and log files—ensure these new patterns are appended to the existing node_modules/, dist/, *.js.map and .DS_Store entries so they are ignored going forward.n8n/nodes/Tinyfish/Tinyfish.node.ts (1)
107-139: Pagination cap may silently truncate results.The
MAX_PAGINATION_ITEMSlimit (10,000) silently truncates results whenreturnAllis enabled. Consider logging a warning or including metadata when results are truncated so users are aware they didn't receive all data.💡 Suggested improvement to inform users of truncation
if (allRuns.length >= MAX_PAGINATION_ITEMS) { + this.logger.warn( + `List Runs reached maximum pagination limit of ${MAX_PAGINATION_ITEMS} items. Results may be incomplete.`, + ); break; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@n8n/nodes/Tinyfish/Tinyfish.node.ts` around lines 107 - 139, The code silently truncates results at MAX_PAGINATION_ITEMS when returnAll is true; modify the loop to detect when you break due to the cap (e.g., set a boolean truncated = true when allRuns.length >= MAX_PAGINATION_ITEMS) and after you push the sliced runs into returnData include a clear indicator for users — either emit a warning via the node context (e.g., this.warn or this.helpers.displayWarning) naming MAX_PAGINATION_ITEMS and the affected operation, and/or append a metadata item to returnData (e.g., push { json: { truncated: true, limit: MAX_PAGINATION_ITEMS }, pairedItem: { item: i } }) so callers can detect truncation; update symbols: returnAll, allRuns, MAX_PAGINATION_ITEMS, tinyfishApiRequest, returnData, pagination.n8n/nodes/Tinyfish/GenericFunctions.ts (1)
203-253: Consider includingstreamingUrlin failure results for debugging.When a run fails, the
streamingUrlis omitted from the result, but it could be useful for debugging purposes (e.g., to review the browser session recording if available).💡 Suggested improvement
} else { finalResult = { status: status || 'FAILED', runId, + streamingUrl, lastProgress, error: eventData.error || 'Unknown error', }; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@n8n/nodes/Tinyfish/GenericFunctions.ts` around lines 203 - 253, The failure branch inside the streaming loop (in GenericFunctions.ts where eventType is handled and finalResult is assigned) omits streamingUrl; update the else branch that sets finalResult for non-"COMPLETED" statuses to include streamingUrl (alongside runId, lastProgress, and error) so failed results also carry the streamingUrl for debugging; locate the block that checks eventType === 'COMPLETE' and modify the finalResult assignment in the non-COMPLETED branch to include the streamingUrl variable.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@n8n/.gitignore`:
- Around line 1-4: Update the repository .gitignore to include common sensitive
and IDE/runtime artifacts in addition to the current entries; add patterns such
as .env, .env.* (or .env.local), .envrc, .vscode/, .idea/, .venv/,
.pytest_cache/, .cache/, coverage/ and *.log to prevent committing environment
files, IDE settings, virtualenvs, test caches, coverage and log files—ensure
these new patterns are appended to the existing node_modules/, dist/, *.js.map
and .DS_Store entries so they are ignored going forward.
In `@n8n/nodes/Tinyfish/GenericFunctions.ts`:
- Around line 203-253: The failure branch inside the streaming loop (in
GenericFunctions.ts where eventType is handled and finalResult is assigned)
omits streamingUrl; update the else branch that sets finalResult for
non-"COMPLETED" statuses to include streamingUrl (alongside runId, lastProgress,
and error) so failed results also carry the streamingUrl for debugging; locate
the block that checks eventType === 'COMPLETE' and modify the finalResult
assignment in the non-COMPLETED branch to include the streamingUrl variable.
In `@n8n/nodes/Tinyfish/Tinyfish.node.ts`:
- Around line 107-139: The code silently truncates results at
MAX_PAGINATION_ITEMS when returnAll is true; modify the loop to detect when you
break due to the cap (e.g., set a boolean truncated = true when allRuns.length
>= MAX_PAGINATION_ITEMS) and after you push the sliced runs into returnData
include a clear indicator for users — either emit a warning via the node context
(e.g., this.warn or this.helpers.displayWarning) naming MAX_PAGINATION_ITEMS and
the affected operation, and/or append a metadata item to returnData (e.g., push
{ json: { truncated: true, limit: MAX_PAGINATION_ITEMS }, pairedItem: { item: i
} }) so callers can detect truncation; update symbols: returnAll, allRuns,
MAX_PAGINATION_ITEMS, tinyfishApiRequest, returnData, pagination.
Summary
n8n-nodes-tinyfish) for TinyFish Web AgentIAuthenticateGeneric, and connection testusableAsToolsupport for n8n AI Agent workflows