Repository navigation
Print jobs for print agents (server-side queue) - #1627
Draft
francisrath wants to merge 12 commits into
Draft
francisrath wants to merge 12 commits into
francisrath wants to merge 12 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds a Tools entry for the print agent page and documents the agent contract. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bulk lot action and hand-typed ids can contain spaces, ';' or empty entries, which agents don't have to accept. Also: lowercase pairing key, popup without opener, per-profile labels on the menu icons, and the docs now say which bytes form the HMAC key and how agents should check ts, replays and src. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agents register with an API token of their owner and identify themselves by a UUID, so renewing the token keeps them. Jobs are never re-queued automatically. Label profiles get an optional default printer id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agents send a heartbeat with their printers, list their pending jobs, claim one atomically and report the result. Only API tokens are accepted, and agents only see their owner's jobs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The label dialog offers the user's agent printers (default printer of the profile first), the label menu icon prints on the profile's default printer, and the parts table gets "print labels" actions. Without agent printers the buttons keep handing labels to the browser's local agent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The print agent page lists your agents with their printers and recent jobs, with "send again", cancel and remove. Label profiles get a default printer field that suggests the printer ids your agents report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- reject heartbeats over 64 KiB, and require API access for agents - the lot print action falls back to the dialog for parts without lots - cancelling a job is atomic against an agent claiming it - "send again" refuses printers the agent no longer reports - redirects after printing refuse control characters - label menus look up the user's printers once per request - the agents page shows the reported model, media and status Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 29, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1625; the second of three alternative PRs. It includes #1626. The commits new here start at "feat(agents): agent and agent job entities".
With #1626 the browser has to run on the same computer as the agent. This PR lets Part-DB keep the jobs instead: the agent connects outbound to Part-DB and fetches them. Printing then works from any device, phones included, and through NAT, with the agent on a PC or a Raspberry Pi next to the printer.
What it adds
AgentandAgentJob, plus a migration for MySQL, PostgreSQL and SQLite.{type: "print", printer, payload: {profile_id, element_type, element_ids}}with a status./<locale>/agent-api/v1, documented indocs/usage/labels.md:POST agents/<uuid>/heartbeat: the agent registers and reports its printers.GET agents/<uuid>/jobsPOST jobs/<id>/claim: atomic; returns 409 if the job was taken.POST jobs/<id>/resultPart-DB never re-queues a job by itself. A job claimed but never reported shows as "unknown" after 10 minutes, and the user can send it again. Finished jobs are deleted after 30 days.
Screenshots
The Print button in the label dialog, with the printer picker:

The menu icon that sends a label straight to the profile's default printer:

The agents page (Tools → Print agent):

Decisions you may want differently
Tests
AgentApiControllerTest,LabelControllerTest(many new cases),PartsTableActionHandlerTest,tests/Entity/AgentSystem/AgentJobTest.php.lint:twiganddoctrine:schema:validatepass.🤖 Generated with Claude Code