infiniti.rewrite package. It uses one transformer for manual and automatic work. Automatic work stores its output with the source clip and never changes the system clipboard.
1
Scaffold a v3 package
Run the ClipsX package CLI and keep its pinned
clipsx:extension@3.0.0 WIT file. Set schemaVersion = 3, contractRevision = 1, and apiVersion = "^3.0" in the manifest.2
Declare the transformer
Add a
text/plain transformer named rewrite. Set resultLifetime = "source_clip" so completed output survives restart, package updates, disablement, and uninstall while its source clip exists.3
Request generation
Declare the generation capability. Send separate system and user messages, treat the selected text as data, cap output tokens, and return only rewritten text. ClipsX chooses the provider and keeps endpoint, model, and credentials private.
4
Add presets and parameters
Use the tested presets Business, Casual, Concise, Improve Writing, Translate, and Custom. Translate requires
targetLanguage; Custom requires a nonempty customInstruction of at most 4 KiB. The host validates the same bounded parameter schema before manual and automatic execution.5
Configure app rules
Declare a
clip.created activation that targets the transformer. Users opt in by selecting an observed application and preset. Useful examples are Outlook to Business, Slack to Casual, and VS Code to Custom with “concise technical” instructions. Rules use the selected platform-specific application ID; there is no wildcard rule.6
Work with durable results
Completed outputs appear in the source clip’s Results section. Users explicitly choose Copy, Paste, Regenerate, Delete, or Save as new clip. Saving creates an independent canonical clip; deleting the source removes its attached results.
7
Handle cancellation and state
The host cancels unfinished work when its source, permission, rule, package version, or relevant configuration changes. Package state is declared, bounded, device-local, and scoped to the package. Do not use state as generated-output storage.
8
Test the package
Build the guest, run package conformance, and test manual execution, duplicate capture deduplication, provider recovery, cancellation, restart recovery, source deletion, and promotion. Verify that automatic execution never writes to the clipboard.
9
Package and publish
Build an immutable archive, validate it with the package CLI, and publish its checksum and complete permission fingerprint through the registry. Never replace a released archive.
Build every extension against the v3 WIT and manifest. The host runs the v3 contract only.