More capabilities for tentacles, for an upcoming one

This commit is contained in:
lilmike committed 2026-11-23 08:25:36 -08:00
1 parent ffc5107112
commit a34d7e70c8
53 files changed
+2744 -131

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
# Application-scoped Tentacle commands
Protocol 1.1 optionally negotiates the `application-bindings` API. It is an API,
not an automation permission, and requires neither presentation nor interaction.
The Go and Python SDKs expose the `application` command field. Older readers
reject packages requesting the unsupported API before starting them.
A command may declare `application: "Example App"` and propose global bindings
within that application. The selector is an exact X11 WM_CLASS instance or class,
containing 1–127 bytes of nonempty printable UTF-8. Titles and wildcard patterns
are never interpreted. Scope declarations require the negotiated API; protocol
1.0 and ungranted declarations cannot opt in silently.
Local development specs opt in with `SessionEvents: true` and
`ApplicationBindings: true`. Native package manifests include `session-events`
and `application-bindings` in their API list and protocol minor 1. Registry entries
persist the API opt-in separately from install permissions.
Application shortcuts use passive grabs on the matching client window, leaving
the desktop root window available to other shortcut owners. Core global commands,
explicit user assignments and earlier Tentacles retain priority. Unmodified
browser defaults apply outside the selected application. An ancestor/global X11
shortcut owner may still take priority over a client-window shortcut.
The input owner refreshes application context on its bounded focus poll after
held chords release. Activation can take up to one poll interval (100 ms).
Inactive application bindings introduce no per-chord native metadata queries.
Native admission rechecks actual focus and class, while the ordinary browse/OCR
source checks retain their own anchors. Changing application bindings never
retargets an existing OCR result to a different window.
Unavailable or conflicting client grabs disable only the optional application
bindings. All client grabs are removed after a partial failure, core controls
remain owned, and shortcut help marks the application commands unavailable.
Re-entering the application or changing keyboard configuration retries them.
Destroying a client window is an expected lifecycle event.
The Python/Go 1.0 and ordinary 1.1 contracts remain unchanged. Existing unscoped
Tentacle shortcuts retain the prior OCR input-retirement policy. Application
commands have no mouse or OCR automation authority unless they separately declare
and receive a separate automation permission.
X11 is supported. Native Wayland application shortcut registration is unavailable.
These selectors provide scope, not application authentication or a sandbox.
+67
View File
@@ -0,0 +1,67 @@
# Opt-in application automation
This extension builds on `application-bindings`. Protocol 1.1 negotiates an
additional `automation` API and install permission. It requires presentation,
interaction and application bindings, but none of those permissions imply
this new grant. Existing installations do not acquire automation authority.
Older readers reject the unsupported API/permission during package validation.
An application command additionally declares `automation: true`. The host
checks the declaration against the explicit install grant before activation.
Returning an automation result from an ordinary interactive command grants no
authority. The Go SDK exports `Automation`, `AutomationAction` and
`Command.Automation`; Python uses the matching command flag and result dictionary.
Local development specs opt in with `SessionEvents`, `ApplicationBindings`,
`Presentation`, `Interaction`, and `Automation` all true. Package manifests include
`commands`, `session-events`, `presentation`, `interaction`, `application-bindings`
and `automation` APIs, with `presentation`, `interaction`, and `automation`
capabilities. Registry entries retain the automation grant across restart.
Install confirmation names mouse/OCR control separately from forms/clipboard access.
A terminal interaction may return:
```json
{"automation":{"actions":[{"kind":"move","x":5000,"y":5000},{"kind":"click","button":3,"modifier":"shift","milliseconds":20},{"kind":"delay","milliseconds":100},{"kind":"move","x":10000,"y":0}]},"done":true}
```
It cannot combine with forms, continuations, clipboard/source requests, reader
settings, remote requests, protected speech, or background leases. Up to 16 actions
are admitted, with at most 2,000 ms of aggregate requested waits and a five-second
worker deadline. The Tentacle owns shortcut choices and explicit action timing.
| Kind | Fields | Meaning |
| --- | --- | --- |
| `move` | `x`, `y`, each 0–10000 | Move relative to the captured client rectangle, rounded and clamped inside it |
| `click` | `button`: 1 or 3; optional `modifier`: `shift` or `control`; `milliseconds`: 0–1000 | Click at the pointer, holding the button for the requested duration |
| `drag` | `x`, `y`, each 0–10000; `milliseconds`: 0–1000 | Left-button drag, waiting for the requested duration before and after motion |
| `scroll` | nonzero `steps`: −100 to 100; `milliseconds`: 0–1000 | Wheel up/down, waiting for the requested duration between steps |
| `delay` | `milliseconds`: 1–1000 | Cancellable wait |
| `ocr-route` | none | First action only: route to the current recognized word |
| `ocr-dismiss` | none | Retire OCR internally; send no Escape to the application |
| `ocr-scan` | none | Last action only: start a window OCR scan with an X server timestamp cutoff |
| `tone` | none | Optional reader feedback; playback failure does not block input |
Unrelated fields are rejected. The reader captures the application window,
foreground epoch and client bounds before invoking the child, checks them between
effects, and uses the secure-input gate at every injected step. It waits for
captured chord release before injecting. Physical keys (including modifiers still
held after the captured keys release) or mouse buttons cause refusal.
It retires the old OCR result before mouse effects.
OCR routing retains a private capture snapshot and checks fresh pixels after
shortcut release, immediately before routing. Native focus and frozen bounds
protect the following route-to-click interval; normal hover highlights do not
invalidate the click. Missing, clipboard, changed or unmapped results are refused.
No OCR text or native handles reach the child.
Waits belong to cancellable Go code. Native steps atomically check class, focus
and geometry before input; no wait holds the X server or secure-input mutex.
Cleanup releases every synthetic button/modifier after cancellation, focus changes,
locks or errors. Process revocation cancels the joined interaction worker. Commands
are declined while an interaction is occupied rather than queued indefinitely.
X11 is supported; native Wayland automation is unavailable. The API provides
reader-owned lifecycle checks, not an account sandbox or application authentication.
Live application behavior, audible feedback and physical input need acceptance
separate from protocol and private-display tests.