Commit Graph

122 Commits

Author SHA1 Message Date
Lucas Berger 893a37e9c9 chore(09-04): defer batch Update to Phase 9.1
- Remove Update button from batch select (not implemented)
- Document in STATE.md: batch update needs sub-workflow modularization
- Batch Start and Stop work; Update requires complex 5-step sequence

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 10:24:08 -05:00
Lucas Berger 5a0d73cb98 fix(09-04): fix Delete Batch Select Message chatId reference
Reference Prepare Immediate Batch Exec directly for chatId/messageId
instead of $json which is the Telegram response from previous node.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 10:18:55 -05:00
Lucas Berger 36345b0de8 fix(09-04): fix batch Start from inline keyboard
Prepare Batch Exec now references Prepare Immediate Batch Exec directly
instead of relying on $json which gets overwritten by Delete Batch
Select Message. Also handles both 'action' and 'batchAction' field names.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 10:17:36 -05:00
Lucas Berger 20ec40336e fix(09-04): fix Clear button in batch select
- Add batchPage to Handle Batch Clear output
- Update Rebuild Batch Select Keyboard to also check Handle Batch Clear
  as data source

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 10:14:45 -05:00
Lucas Berger 660b969f6e feat(09-04): add Start button to batch select action row
Now shows Start, Stop, and Update buttons when containers are selected.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 10:13:36 -05:00
Lucas Berger ee4205d61d fix(09-04): show all containers in batch select (including stopped)
Changed Fetch Containers For Batch Mode and Fetch Containers For Toggle
Update to use all=true instead of all=false, so stopped containers
appear in the batch select list for batch start operations.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 10:12:12 -05:00
Lucas Berger ec9e0a07a4 fix(09-04): preserve selection when navigating batch select pages
- Add batch:nav callback type for page navigation with selection
- Parse batch:nav in Parse Callback Data
- Add route for isBatchNav in Route Callback switch
- Add Prepare Batch Nav node to format data for rebuild
- Update Rebuild Batch Select Keyboard to use batch:nav for navigation
- Now Previous/Next buttons preserve selected containers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 10:02:31 -05:00
Lucas Berger 5ab66de4c2 fix(09-04): fix batch cancel routing and pagination after toggle
- Don't set isCancel:true for batch:cancel (was routing to wrong handler)
- Add page to batch:toggle callback format: batch:toggle:{page}:{selected}:{name}
- Parse page in Parse Callback Data for toggle callbacks
- Pass page through Handle Batch Toggle
- Add pagination to Rebuild Batch Select Keyboard (6 per page)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 09:57:57 -05:00
Lucas Berger 713fdaa00d feat(09-04): add pagination to batch select menu
- Parse Callback Data now handles batch:mode:{page} format
- Build Batch Select Keyboard uses 6 containers per page
- Added Previous/Next navigation buttons
- Shows "Showing X-Y of Z" count when paginated

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 09:52:36 -05:00
Lucas Berger 3192eb3ea0 fix(09-04): batch cancel returns to container list instead of deleting message
- Replace Delete Batch Cancel Message with Prepare Batch Cancel Return code node
- Connect Prepare Batch Cancel Return to Get Containers For List
- Update Build Paginated List to accept data from multiple sources
- Cancel now shows the container list instead of deleting the menu

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 09:51:18 -05:00
Lucas Berger ddbae3c54e fix(09-04): replace splitInBatches with manual loop for batch execution
- Route Batch Loop Action now references Build Progress Message node
- Build Batch Action Command references Build Progress Message node
- Prepare Batch Loop outputs single item with currentIndex for manual loop
- Prepare Next Iteration increments currentIndex and sets next container
- Is Batch Complete loops back to Build Progress Message instead of Batch Loop
- Bypasses problematic splitInBatches node that wasn't processing items

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 09:46:18 -05:00
Lucas Berger 7d6e683f87 feat(09-03): add update all and inline multi-select for batch operations
Task 1: Update All Command
- Detects 'update all' or 'updateall' in Keyword Router
- Fetches all containers and filters to :latest tag containers
- Shows confirmation with count and list (up to 10 displayed)
- On confirm: passes to batch execution infrastructure
- Shows 'All containers are up to date!' if no :latest containers
- 30-second timeout on confirmation

Task 2: Inline Multi-Select
- Added batch:mode callback to enter selection mode
- batch:toggle:{csv}:{name} for toggling container selection
- batch:exec:{action}:{csv} for executing batch actions
- batch:clear and batch:cancel for selection management
- Checkmarks show selected containers in keyboard
- Action buttons appear when selection exists
- Callback size limit enforced (max ~8 containers)
- Stop action requires confirmation (per existing batch flow)
- Update/start/restart execute immediately

Integration:
- Both flows connect to existing batch execution from 09-02
- Reuses batch loop and progress display infrastructure
2026-02-04 08:17:04 -05:00
Lucas Berger b704a6cff2 feat(09-02): add batch summary with failure emphasis
- Add Is Batch Complete IF node to check loop termination
- Add Build Batch Summary code node with failure-first format
- Add Send Batch Summary HTTP node with Back to List button
- Connect Is Batch Complete true output to summary flow
- Connect Is Batch Complete false output back to Batch Loop
- Summary shows failures with reasons prominently
- Warnings shown in detail (<=3) or summary (>3)
- Success count shown last
2026-02-03 21:33:28 -05:00
Lucas Berger fd4c614afd feat(09-02): add per-container progress updates and action execution
- Add Build Progress Message node for per-container status display
- Add Edit Progress Message to update Telegram with current progress
- Add Route Batch Loop Action switch for action-specific execution
- Add Build Batch Action Command with container lookup support
- Add Execute Batch Container Action with error handling
- Add Check Batch Action Result for lookup vs direct action
- Add Needs Action Call IF node for two-phase execution
- Add Execute Batch Action 2 for follow-up action calls
- Add Parse Batch Action 2 for result handling
- Add Handle Action Result to aggregate success/failure counts
- Add Prepare Next Iteration for loop continuation
- Add Prepare Batch Stop Exec for confirmed stop callbacks
- Add Prepare Batch Exec for bexec callbacks
- Connect Check Batch Stop Expired to execution flow
- Connect Answer Batch Exec to execution flow
2026-02-03 21:32:03 -05:00
Lucas Berger 62f50cb502 feat(09-02): add loop over items for sequential batch execution
- Add Initialize Batch State code node to prepare batch data
- Add Send Batch Start Message to show initial progress
- Add Prepare Batch Loop to format containers for iteration
- Add Batch Loop (splitInBatches) for sequential processing
- Connect Route Batch Action outputs (update/start/restart) to batch flow
2026-02-03 21:28:33 -05:00
Lucas Berger feea06c4c3 feat(09-01): wire batch routing and add batch stop confirmation
- Add "Route Batch Action" switch node (update/start/restart/stop)
- Add "Build Batch Stop Confirmation" code node with confirm/cancel keyboard
- Add "Send Batch Stop Confirmation" HTTP node
- Update Parse Callback Data to handle bstop: and bexec: prefixes
- Add Route Callback outputs for batch stop confirm/cancel/exec
- Add callback handler nodes for batch operations:
  - Answer Batch Stop Confirm with 30-second timeout check
  - Answer Batch Stop Cancel with message deletion
  - Answer Batch Exec for batch execution callbacks
- Add Check Batch Stop Expired with expiry message flow

Routing behavior:
- update/start/restart: route immediately to batch execution (Plan 02)
- stop: requires confirmation due to fuzzy matching risk
- Confirmation callback format: bstop:confirm:{names}:{timestamp}
- Cancel callback: bstop:cancel
2026-02-03 21:22:19 -05:00
Lucas Berger f02f98406c feat(09-01): add container matching with exact-match priority
- Add "Match Batch Containers" code node with exact-match-first algorithm
- Add "Needs Disambiguation" IF node to route ambiguous matches
- Add "Build Disambiguation Message" code node with inline keyboard
- Add "Send Disambiguation" HTTP node to display options
- Add "Has Not Found" IF node to handle missing containers
- Add "Build Not Found Message" code node with partial match confirmation
- Add "Send Not Found Message" HTTP node

Matching algorithm:
1. Exact match first: 'plex' matches 'plex' even if 'jellyplex' exists
2. Single fuzzy match: treated as found
3. Multiple fuzzy matches: triggers disambiguation with keyboard options
4. No matches: reported as not found with option to proceed with found containers
2026-02-03 21:19:01 -05:00
Lucas Berger 9e7ff2ab08 feat(09-01): add batch command detection and parsing
- Add "Detect Batch Command" code node to parse multi-container commands
- Add "Is Batch Command" IF node to route batch vs single container
- Add "Route Single Action" switch to route single commands to appropriate flow
- Add "Get Containers for Batch" node for Docker API container list
- Modify Keyword Router to route restart/start/stop/update through batch detection
- Single container commands route to existing Parse Action/Update Command flows
- Batch commands (2+ containers) route to new batch processing flow

Batch detection logic:
- Pattern: {action} {name1} {name2} ... where action is update/start/stop/restart
- Single container = not batch (existing flow)
- Two or more containers = batch (new flow)
2026-02-03 21:16:41 -05:00
Lucas Berger d1da276aa4 fix(08): resolve n8n deployment issues and clean up orphan nodes
Bug fixes:
- Fix array handling in Code nodes ($input.all() vs $input.item.json)
  - Build Logs Action Command
  - Build Confirmed Stop Command
  - Build Immediate Action Command
  - Find Container For Update
- Add timestamp to logs refresh to avoid "message not modified" error
- Add :latest tag protection to callback update flow
- Add image cleanup after callback updates

Cleanup:
- Remove orphan nodes: Parse and Match, Format Response, Send Docker Response
- Rename duplicate "Inspect New Image" to "Inspect New Image (Text)"
- Restore Compare Digests to fix text update command flow
- Add callback image cleanup nodes (Build Callback Remove Image, Callback Remove Old Image)

Both text commands and inline keyboard buttons now work correctly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 20:31:20 -05:00
Lucas Berger 1331ee1331 wip(08): paused at verification checkpoint - workflow fixes in progress 2026-02-03 17:04:12 -05:00
Lucas Berger 127f176056 feat(08-03): enhance update progress with explicit button removal
- Update progress message uses upward arrow icon for update
- Add "This may take a few minutes" notice
- Explicitly pass empty inline_keyboard to remove buttons
- Prevents accidental duplicate action triggers during update

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 16:34:53 -05:00
Lucas Berger 3e11dea2ed feat(08-03): simplify completion messages to back-only button
- Update Format Immediate Result for start/restart actions
- Update Format Confirmed Stop Result for stop action
- Update Format Update Complete for update action
- Update Format No Update Needed for already-up-to-date case
- Success shows only "Back to Containers" button
- Errors show "Try Again" + "Back to Containers" buttons
- Removes action buttons from completion state per UX spec

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 16:34:10 -05:00
Lucas Berger ab7ce88792 feat(08-02): add confirmation flow for dangerous actions
- Update Parse Callback Data to handle confirm: and cancel: callbacks
- Add isConfirm and isCancelConfirm outputs to Route Callback switch
- Add 30-second timeout check for confirmations (timestamp in callback_data)
- Wire confirmed stop action to container stop flow with result display
- Wire confirmed update action to full update flow (pull, recreate, start)
- Handle cancel by returning to container submenu
- Show expired message when confirmation times out
- Progress indicator during update: "Updating..."

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 16:28:33 -05:00
Lucas Berger d1584197f8 feat(08-02): route action callbacks to container operations
- Add Answer Action Callback node to answer query immediately
- Add Route Action Type switch with start/restart/stop/update/logs outputs
- Wire start/restart to immediate action flow (Get Container, Build Command, Execute, Format Result)
- Wire logs to logs action flow with 30-line display
- Wire stop/update to confirmation dialog builders with 30s timeout
- All action results update message in-place with editMessageText

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 16:24:21 -05:00
Lucas Berger 393d368dec feat(08-01): handle list pagination callbacks
- Add Answer List Callback HTTP node (prevents loading indicator)
- Add Prepare List Fetch code node
- Add Get Containers For List HTTP Request node
- Add Build Paginated List code node (reuses keyboard logic)
- Add Edit Container List HTTP node (editMessageText for in-place updates)
- Wire Route Callback list output to pagination flow
- All page transitions use message edits (no new messages)
2026-02-03 16:18:50 -05:00
Lucas Berger 01482827fb feat(08-01): add container submenu with action buttons
- Update Parse Callback Data to recognize select:, list:, action:, noop formats
- Add Route Callback outputs: select, list, action, noop
- Add Answer Select Callback HTTP node (prevents loading indicator)
- Add Prepare Container Fetch code node
- Add Get Single Container HTTP Request node
- Add Build Container Submenu code node with state-based action buttons
- Add Send Container Submenu HTTP node (editMessageText for in-place updates)
- Add Answer Noop Callback for page indicator button
- Wire complete select flow: Route -> Answer -> Fetch -> Submenu -> Send
2026-02-03 16:17:38 -05:00
Lucas Berger f8d616e26d feat(08-01): add container list inline keyboard
- Add Build Container List Keyboard code node
- Add Send Container List HTTP Request node
- Add Check Single Container IF node for direct access routing
- Add Build Container Submenu Direct for /status <name> flow
- Add Send Container Submenu Direct HTTP Request
- Wire Keyword Router status -> Docker List -> Build Keyboard flow
- Running containers shown first with green icon
- Pagination support for >6 containers
2026-02-03 16:15:29 -05:00
Lucas Berger b02819434f fix(07-02): remove duplicate timeout on image pull
- Image pull had --max-time 600 --max-time 5 (second wins = 5s timeout)
- Removed duplicate, keeping 600s for large image pulls
- Added WEB-01 requirement for webhook fix in Phase 10
- Created 07-02-SUMMARY.md and 07-VERIFICATION.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 11:11:39 -05:00
Lucas Berger 5471feec25 fix(07-02): correct Telegram credential name and ID
- Change credential name from "Telegram API" to "Telegram account"
- Update credential ID from placeholder to actual n8n ID (I0xTTiASl7C1NZhJ)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 09:18:13 -05:00
Lucas Berger 12bdd9802b refactor(07-02): migrate n8n workflow from Docker socket to proxy
- Replace all --unix-socket /var/run/docker.sock with docker-socket-proxy:2375
- Add --max-time 5 timeout to all commands (except image pull which keeps 600s)
- Update 16 curl commands across all bot operations (status, start, stop, restart, update, logs)
- No functional changes, all commands routed through security proxy
2026-02-03 09:09:48 -05:00
Lucas Berger c979a7fe7b feat(update): notify user when container is already up to date
Previously the "no update needed" branch was empty, leaving users
with no feedback after the update check completed.

Added Format No Update and Send No Update nodes to display
"<container> is already up to date" message.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 21:39:08 -05:00
Lucas Berger 808d1afe21 fix(logs): correct property name for line count parameter
Parse Logs Command returned 'lineCount' but Match Logs Container
expected 'lines', causing the line count to always be undefined
and Docker to return its default.

Renamed to 'lines' for consistency throughout the logs flow.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 21:33:39 -05:00
Lucas Berger 287c7220cb fix(logs): escape HTML entities in log output
Log content may contain <, >, & characters (like "<computed>") which
Telegram interprets as HTML tags when using parse_mode=HTML.

Added escapeHtml() function to convert:
- & → &amp;
- < → &lt;
- > → &gt;

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 21:31:22 -05:00
Lucas Berger 74dd8f1a94 fix(update): ensure image tag is specified to prevent pulling all tags
When Config.Image has no tag (e.g., "nitnelave/lldap" instead of
"nitnelave/lldap:latest"), Docker's API pulls ALL tags for that image.
This caused massive downloads and rate limit hits.

Now appends ":latest" if no tag or digest is present in the image name.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 21:21:57 -05:00
Lucas Berger 3e3b9ae47f fix(update): pipe pull output through tail to prevent memory exhaustion
Docker's /images/create API streams progress JSON for every layer.
For large images, this can be gigabytes of output that was being
buffered by curl and n8n, causing hangs and disk usage spikes.

Now pipes through `tail -c 10000` to only keep the last 10KB where
error/success messages appear. Discards the streaming progress data.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 21:14:25 -05:00
Lucas Berger 88830a8b61 fix(update): correct image removal node data reference
- Reference $('Format Update Result') instead of $json for currentImageId
- The Telegram node doesn't pass through input data, it returns API response
- Also add no-op command fallback when currentImageId is missing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 20:56:00 -05:00
Lucas Berger 4f85e00dc4 fix(update): add timeout to prevent pull command from hanging
- Add --max-time 600 (10 min) to curl pull command
- Add timeout: 660 to n8n executeCommand node

Docker's /images/create API streams progress until complete.
Without timeout, large image pulls could hang indefinitely.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 20:50:22 -05:00
Lucas Berger d03e79cc7f feat(05): add update acknowledgment and pull error handling
1. Send "Updating <container>..." message immediately when update starts
   so user knows the command was received during long image pulls

2. Check pull response for rate limiting and other errors before
   continuing with update. Errors like "toomanyrequests" now show
   a proper error message instead of silently failing to update.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 22:07:40 -05:00
Lucas Berger 0839c44b50 feat(05): remove old image after successful container update
Mimics Unraid's update behavior by removing the orphan image after
the new container is started. The old image ID is now passed through
the entire update flow and used to call DELETE /images/{id} at the end.

Removal is fire-and-forget with force=false so it will fail gracefully
if another container still uses the image.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 21:58:41 -05:00
Lucas Berger 004911ea32 fix(05): improve container matching to prioritize exact matches
Fixed matching in Match Container, Match Update Container, and Match
Logs Container nodes:
1. First check for exact name match (e.g., "jellyplex" matches only jellyplex)
2. Then fall back to substring matching (container name contains query)
3. Removed reverse matching (query contains container name) which caused
   "jellyplex" to incorrectly match "plex"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 21:41:27 -05:00
Lucas Berger 0b6dfe69d9 fix(05-01): escape angle brackets in Show Menu text
Changed <name> to [name] to avoid HTML parse errors in Telegram.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 21:36:23 -05:00
Lucas Berger 0b140c4f1e fix(05-01): simplify Show Menu to text-only help message
Native Telegram node replyKeyboard wasn't displaying. Fallback to
simple text message listing available commands. Can revisit persistent
keyboard feature later.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 21:34:45 -05:00
Lucas Berger 6defb2daaf fix(05-01): switch Show Menu to native Telegram node
HTTP Request node with $credentials reference was causing 404 errors.
Native Telegram node handles credentials more reliably for static menus.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 21:31:16 -05:00
Lucas Berger 32fd965a2f fix(05-02): revert credential reference to hardcoded user ID
n8n IF nodes don't support credentials - $credentials syntax only works
in nodes that make external calls. Reverted to direct user ID in the
IF conditions and updated README with simpler configuration instructions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 21:28:20 -05:00
Lucas Berger 1e6c31f790 feat(05-02): migrate user ID to n8n credentials system
- Auth nodes now reference $credentials.telegramAuth.userId
- Added telegramAuth credential reference to both IF nodes
- Removed hardcoded user ID from workflow JSON
- Workflow can now be safely exported/shared
2026-01-31 21:15:20 -05:00
Lucas Berger cab0914788 chore(05-02): standardize error messages to terse format
- Docker socket errors now show 'Cannot connect to Docker'
- Action failures now show 'Failed to {action} {container}'
- Removed HTTP status codes and technical details from error messages
- Simplified callback action error handling
2026-01-31 21:14:36 -05:00
Lucas Berger a29f444e08 feat(05-01): replace NLU/Claude with keyword routing
- Remove Prepare Claude Request, Claude Intent Parser, Parse Intent,
  Intent Router, Send Unknown Intent, Send Intent Error nodes
- Remove Anthropic API credential reference
- Rename Route Message to Keyword Router with updated rules
- Update IF User Authenticated to connect to Keyword Router
- Update Parse and Match to work without NLU context
- Update Parse Action Command to parse from message text directly
- Update Match Container to reference Parse Action Command
- Update Parse Logs Command to work with keyword routing

Keyword Router handles: /start, status, restart, start, stop,
update, logs with fallback to menu

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 21:09:33 -05:00
Lucas Berger 5e7cab54ca fix(batch): convert Send Batch Confirmation to native Telegram node
HTTP Request node with credential access via URL expression was
failing. Native Telegram node handles credentials internally and
is more reliable for this use case.
2026-01-30 22:37:09 -05:00
Lucas Berger 23ce6a88d5 fix(batch): add chatId validation in Build Batch Keyboard
Add defensive error handling to throw clear error if chatId is
missing before attempting to send Telegram message. This helps
debug 'resource not found' errors by identifying data flow issues.
2026-01-30 22:36:44 -05:00
Lucas Berger 5d55bdecac fix(04): fix type validation in all Switch nodes with number comparisons
Fixed Check Match Count and Check Update Match Count nodes:
- Changed typeValidation from 'strict' to 'loose'
- Changed rightValue from strings ('0', '1') to numbers (0, 1)
- Removed empty leftValue from options

This fixes 'Wrong type: string but expecting number' errors.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 22:26:08 -05:00